<?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: How to get the X,Y Coordinates  vertices of selected polygon feature in C# in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-get-the-x-y-coordinates-vertices-of/m-p/1033301#M20263</link>
    <description>&lt;P&gt;Thank you very much, this really helped&lt;/P&gt;</description>
    <pubDate>Fri, 05 Mar 2021 08:45:42 GMT</pubDate>
    <dc:creator>worlanyo</dc:creator>
    <dc:date>2021-03-05T08:45:42Z</dc:date>
    <item>
      <title>How to get the X,Y Coordinates  vertices of selected polygon feature in C#</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-get-the-x-y-coordinates-vertices-of/m-p/1031477#M20258</link>
      <description>&lt;P&gt;I need help with a sample code to get the X,Y Coordinates of the vertices of a selected polygon feature. I intend to pass this to text elements on the pagelayout control. Any help will be greatly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;&lt;P&gt;Worlanyo&lt;/P&gt;</description>
      <pubDate>Mon, 01 Mar 2021 14:01:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-get-the-x-y-coordinates-vertices-of/m-p/1031477#M20258</guid>
      <dc:creator>worlanyo</dc:creator>
      <dc:date>2021-03-01T14:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the X,Y Coordinates  vertices of selected polygon feature in C#</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-get-the-x-y-coordinates-vertices-of/m-p/1031525#M20259</link>
      <description>&lt;P&gt;Here is a sample that gets you from an IFeature (from a cursor) to a List of all the points (type PointF)...&lt;/P&gt;&lt;P&gt;Hope it helps.&lt;/P&gt;&lt;P&gt;Brent Hoskisson&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;		private void GetVertices(IFeature f)
		{
			IPolygon4 parcel = f.Shape as IPolygon4;
			if (parcel != null)
			{
				List&amp;lt;List&amp;lt;System.Drawing.PointF&amp;gt;&amp;gt; polycoll = new List&amp;lt;List&amp;lt;System.Drawing.PointF&amp;gt;&amp;gt;();
				if (parcel.ExteriorRingCount &amp;gt; 0)
				{
					IGeometryBag exteriorRings = parcel.ExteriorRingBag;
					IEnumGeometry exteriorRingsEnum = exteriorRings as IEnumGeometry;
					exteriorRingsEnum.Reset();
					int ering = 0;
					IRing currentExteriorRing = exteriorRingsEnum.Next() as IRing;
					int extrings = parcel.ExteriorRingCount;
					while (extrings &amp;gt; 0 &amp;amp;&amp;amp; currentExteriorRing != null)
					{
						ering++;
						ISegmentCollection segments = currentExteriorRing as ISegmentCollection;

						List&amp;lt;System.Drawing.PointF&amp;gt; spc = ProcessRing(segments);
						if (spc != null)
							polycoll.Add(spc);

						IGeometryBag interiorRings = parcel.InteriorRingBag[currentExteriorRing];
						IEnumGeometry interiorRingsEnum = exteriorRings as IEnumGeometry;
						interiorRingsEnum.Reset();
						int iring = 0;
						IRing currentInteriorRing = exteriorRingsEnum.Next() as IRing;
						int intrings = parcel.InteriorRingCount[currentExteriorRing];
						while (intrings &amp;gt; 0 &amp;amp;&amp;amp; currentInteriorRing != null)
						{
							iring++;
							ISegmentCollection insegments = currentInteriorRing as ISegmentCollection;
							List&amp;lt;System.Drawing.PointF&amp;gt; inspc = ProcessRing(insegments);
							if (inspc != null)
								polycoll.Add(inspc);

							currentInteriorRing = interiorRingsEnum.Next() as IRing;
							if (iring &amp;gt;= intrings)
								break;
						}
						currentExteriorRing = exteriorRingsEnum.Next() as IRing;
						if (ering &amp;gt;= extrings)
							break;
					}
				}
			}
			//do something with polycoll...
		}

		private List&amp;lt;System.Drawing.PointF&amp;gt; ProcessRing(ISegmentCollection segments)
		{
			int segcount = segments.SegmentCount;
			IEnumSegment enumsegment = segments.EnumSegments as IEnumSegment;
			if (enumsegment == null)
			{
				return null;
			}
			enumsegment.Reset();
			int partIndex = 0;
			int segIndex = 0;
			ISegment querySeg;
			enumsegment.Next(out querySeg, ref partIndex, ref segIndex);

			List&amp;lt;System.Drawing.PointF&amp;gt; spc = new List&amp;lt;System.Drawing.PointF&amp;gt;();
			while (querySeg != null &amp;amp;&amp;amp; !querySeg.IsEmpty)
			{
				if (querySeg is Line)
				{
					//no additional information.
				}
				else
				{
					//Circle, Ellipse, Bezier...
					//get additional information to store about the line.
				}
				System.Drawing.PointF labpt = new System.Drawing.PointF((float)Math.Round(querySeg.FromPoint.X, 2, MidpointRounding.AwayFromZero),
					(float)Math.Round(querySeg.FromPoint.Y, 2, MidpointRounding.AwayFromZero));
				spc.Add(labpt);
				enumsegment.Next(out querySeg, ref partIndex, ref segIndex);
				if (segIndex == 0)
					break;
			}
			if (spc != null)
			{
				spc.Add(spc[0]);  //close the loop by adding the first point to the end...
				return spc;
			}
			else
			{
				return null;
			}
		}
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 01 Mar 2021 15:42:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-get-the-x-y-coordinates-vertices-of/m-p/1031525#M20259</guid>
      <dc:creator>BrentHoskisson</dc:creator>
      <dc:date>2021-03-01T15:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the X,Y Coordinates  vertices of selected polygon feature in C#</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-get-the-x-y-coordinates-vertices-of/m-p/1033301#M20263</link>
      <description>&lt;P&gt;Thank you very much, this really helped&lt;/P&gt;</description>
      <pubDate>Fri, 05 Mar 2021 08:45:42 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/how-to-get-the-x-y-coordinates-vertices-of/m-p/1033301#M20263</guid>
      <dc:creator>worlanyo</dc:creator>
      <dc:date>2021-03-05T08:45:42Z</dc:date>
    </item>
  </channel>
</rss>

