<?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:The cake is not a lie in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/extracting-elliptical-properties-from-trackcircle/m-p/262384#M6728</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;ah, Excellent. thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;your response was perfect, and also explains the methodology for handling other ArcObjects objects.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the mean time... (as is usually the case when one finds a solution), one finds &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;another&lt;/SPAN&gt;&lt;SPAN&gt; solution, staring me right in face!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Figured out that the returned geometry can simply be queried for its bounding envelope, and consequently also the centroid.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IGeometry geometry = mapControl.TrackCircle();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; double radius = geometry.Envelope.Width / 2;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IPoint centroid = ((EnvelopeClass)geometry.Envelope).Centroid;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 12:52:03 GMT</pubDate>
    <dc:creator>ManfredLauterbach</dc:creator>
    <dc:date>2021-12-11T12:52:03Z</dc:date>
    <item>
      <title>Extracting elliptical properties from TrackCircle() geometry</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/extracting-elliptical-properties-from-trackcircle/m-p/262381#M6725</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Previously, in &lt;/SPAN&gt;&lt;SPAN style="color:&amp;quot;#FF8C00&amp;quot;;"&gt;the wonderful adventures of Map Objects V2&lt;/SPAN&gt;&lt;SPAN&gt;, getting the radius and centroid of a user tracked circle on the map was as easy as calling a line-liner:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp; Ellipse ellipse = map.TrackCircle(); &amp;nbsp; TheCakeIsReal(ellipse.Center, ellipse.radius);&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;Arc Objects 10&lt;/SPAN&gt;&lt;SPAN&gt;, the universal forces of ESRI and Wheatley incorporated have decided to makes things a little more &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;interesting&lt;/SPAN&gt;&lt;SPAN&gt;.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt; Searched the forums for TrackCircle, but the 3 hits (&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://forums.arcgis.com/search.php?searchid=997900" rel="nofollow" target="_blank"&gt;http://forums.arcgis.com/search.php?searchid=997900&lt;/A&gt;&lt;SPAN&gt;) don't elaborate on extracting properties of the returned geometry. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt; The official API (&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#//001600000201000000" rel="nofollow" target="_blank"&gt;http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#//001600000201000000&lt;/A&gt;&lt;SPAN&gt;) also has a wonderful little description : "TrackCircle returns a geometry object that implements IPolygon.".&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt; Having a look at older forums (&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="http://forums.esri.com/Thread.asp?c=159&amp;amp;f=1706&amp;amp;t=159785" rel="nofollow" target="_blank"&gt;http://forums.esri.com/Thread.asp?c=159&amp;amp;f=1706&amp;amp;t=159785&lt;/A&gt;&lt;SPAN&gt;) brings me a bit closer to the lost treasure of Atlantis, but they are calling a method called 'SetGeometry' on CircleElement, which no longer exists in the ArcObjects 10 API... and has been wiped off the ISurface of existence.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt; I see that GeoEllipse is part of the Military Defence solutions extension - but I would like to be able to extract simple ellipse/circle properties without installing an extension to plan for world war 3.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Tried the following to extract elliptical properties, but all three test candidates realize that the cake is a lie when they have to face the truth that they are not compatible with the returned geometry (polyline) :&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IPolygon polygon = mapControl.TrackCircle() as IPolygon;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CircularArc circularArc = polygon as CircularArc; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CircleElement circleElement = polygon as CircleElement; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RubberCircle rubberCircle = polygon as RubberCircle;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //... circularArc.CenterPoint ? &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //... circularArc.Radius ? &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Once again, could someone please point me in the right direction (for this apparently trivial operation)?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Mar 2012 11:04:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/extracting-elliptical-properties-from-trackcircle/m-p/262381#M6725</guid>
      <dc:creator>ManfredLauterbach</dc:creator>
      <dc:date>2012-03-29T11:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: Interrogating the geometry</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/extracting-elliptical-properties-from-trackcircle/m-p/262382#M6726</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;What is furthermore confusing, are the properties of the polygon (which the geometry claims to be, according to IGeometry.GeometryType) :&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IGeometry geometry = mapControl.TrackCircle();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (geometry.GeometryType == esriGeometryType.esriGeometryPolygon)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Polygon polygon = geometry as Polygon;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (polygon.PointCount == 2)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string polyInfoStr = String.Format("Point 1 : [{0:f2}, {1:f2}]\nPoint 2 : [{2:f2},{3:f2}]", polygon.Point[0].X, polygon.Point[0].Y, polygon.Point[1].X, polygon.Point[1].Y);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBox.Show(polyInfoStr);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Running the code above displays a message with 2 coordinates that are exactly the same.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This would imply that the geometry returned from TrackCircle(), is actually a Polygon with two points, which have exactly the same coordinates.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If the first coordinate were the centroid and the second point were the point on the circumference (representing the mouse up location for the track circle operation) then I would understand, but this is clearly not the case - I made sure that the tracked circle diameter spans a few thousand miles, but the returned coordinates are still equal.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To clarify why I'm expecting different coordinates, the following code tracks a polyline, and display the points in a similar manner. They are displayed correctly:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IGeometry geometry = mapControl.TrackLine();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IPointCollection pointCollection = geometry as IPointCollection;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; StringBuilder pointsInfoStr = new StringBuilder();

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int pointIndex = 0; pointIndex &amp;lt; pointCollection.PointCount; pointIndex++)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IPoint curPoint = pointCollection.Point[pointIndex];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string pointInfo = String.Format("Point {0} : [{1:f2}, {2:f2}]", pointIndex + 1, curPoint.X, curPoint.Y);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pointsInfoStr.AppendLine(pointInfo);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBox.Show(pointsInfoStr.ToString());
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:52:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/extracting-elliptical-properties-from-trackcircle/m-p/262382#M6726</guid>
      <dc:creator>ManfredLauterbach</dc:creator>
      <dc:date>2021-12-11T12:52:00Z</dc:date>
    </item>
    <item>
      <title>Re: Extracting elliptical properties from TrackCircle() geometry</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/extracting-elliptical-properties-from-trackcircle/m-p/262383#M6727</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The polygon returned by TrackCircle is indeed a circle.&amp;nbsp; A polygon is several things.&amp;nbsp; It's a point collection.&amp;nbsp; The point collection contains all of the points that make up the polygon.&amp;nbsp; In the case of a circle, the polygon is made up of a single circular arc.&amp;nbsp; A circular arc is a type of line segment that defined by the boundary of a true circle.&amp;nbsp; In the case of a complete circle, the circular arc begins and ends at the same point.&amp;nbsp; Therefore, the point collection of a polygon that is a circle will contain two points and these points will have identical coordinates.&amp;nbsp; A polygon is a segment collection.&amp;nbsp; The segment collection contains all of the line segments that make up the polygon.&amp;nbsp; In the case of a circle, the segment collection will contain a single segment that is a circular arc.&amp;nbsp; A polygon is also a geometry collection.&amp;nbsp; The geometry collection contains the collection of rings that make up the polygon.&amp;nbsp; Multi-part polygons or polygons with "holes" (a donut for example) are cases where a polygon's geometry collection will contain more than one ring.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So, if you want the center point and radius of a circle polygon then you need to get the circular arc segment from the segment collection.&amp;nbsp; ICircularArc has CenterPoint and Radius properties that you can access.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim segmentCollection As ISegmentCollection = DirectCast(polygon, ISegmentCollection)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim circularArc As ICircularArc = DirectCast(segmentCollection.Segment(0), ICircularArc)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim centerPoint As IPoint = circularArc.CenterPoint&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim radius As Double = circularArc.Radius&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Mar 2012 12:53:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/extracting-elliptical-properties-from-trackcircle/m-p/262383#M6727</guid>
      <dc:creator>NeilClemmons</dc:creator>
      <dc:date>2012-03-29T12:53:14Z</dc:date>
    </item>
    <item>
      <title>Re:The cake is not a lie</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/extracting-elliptical-properties-from-trackcircle/m-p/262384#M6728</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;ah, Excellent. thanks.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;your response was perfect, and also explains the methodology for handling other ArcObjects objects.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the mean time... (as is usually the case when one finds a solution), one finds &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;another&lt;/SPAN&gt;&lt;SPAN&gt; solution, staring me right in face!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Figured out that the returned geometry can simply be queried for its bounding envelope, and consequently also the centroid.&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IGeometry geometry = mapControl.TrackCircle();
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; double radius = geometry.Envelope.Width / 2;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IPoint centroid = ((EnvelopeClass)geometry.Envelope).Centroid;
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 12:52:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/extracting-elliptical-properties-from-trackcircle/m-p/262384#M6728</guid>
      <dc:creator>ManfredLauterbach</dc:creator>
      <dc:date>2021-12-11T12:52:03Z</dc:date>
    </item>
  </channel>
</rss>

