# How to get vertices?

**URL:** <https://community.thinkgeo.com/t/how-to-get-vertices/789>\
**Category:** WinForms\
**Created:** [October 23, 2009, 10:14pm UTC](https://community.thinkgeo.com/t/how-to-get-vertices/789 "2009-10-23T22:14:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ricky](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/r/439d5e/32.png) [@Ricky](https://community.thinkgeo.com/u/Ricky)\
**Post date:** [October 23, 2009, 10:14pm UTC](https://community.thinkgeo.com/t/how-to-get-vertices/789/1 "2009-10-23T22:14:36Z")

</div>

When&nbsp;we&nbsp;draw&nbsp;any&nbsp;shapes&nbsp;(rectangle,&nbsp;polygon,&nbsp;ellipse...etc),&nbsp;i&nbsp;notice&nbsp;they&nbsp;are&nbsp;all&nbsp;represented&nbsp;by&nbsp;PolygonShape,&nbsp;so&nbsp;the&nbsp;user&nbsp;can&nbsp;add/delete/move&nbsp;vertices.&nbsp;Is&nbsp;there&nbsp;any&nbsp;method&nbsp;to&nbsp;retrieve&nbsp;vertices&nbsp;of&nbsp;a&nbsp;shape&nbsp;so&nbsp;i&nbsp;can&nbsp;replicate&nbsp;those&nbsp;shapes&nbsp;in&nbsp;WPF?&nbsp;there&nbsp;is&nbsp;a&nbsp;method&nbsp;"RemoveVertex",&nbsp;but&nbsp;i&nbsp;can't&nbsp;fins&nbsp;a&nbsp;way&nbsp;to&nbsp;retrieve&nbsp;all&nbsp;vertices.

&nbsp;

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [October 25, 2009, 7:31pm UTC](https://community.thinkgeo.com/t/how-to-get-vertices/789/2 "2009-10-25T19:31:07Z")

</div>

Ric,

Thanks&nbsp;for&nbsp;your&nbsp;post&nbsp;and&nbsp;questions.  
&nbsp;  
Yes,&nbsp;as&nbsp;you&nbsp;said,&nbsp;we&nbsp;do&nbsp;not&nbsp;have&nbsp;a&nbsp;built-in&nbsp;API&nbsp;to&nbsp;retrieve&nbsp;all&nbsp;vertecis&nbsp;for&nbsp;any&nbsp;given&nbsp;shape,&nbsp;the&nbsp;reason&nbsp;is&nbsp;that&nbsp;we&nbsp;do&nbsp;not&nbsp;have&nbsp;a&nbsp;very&nbsp;common&nbsp;statndards&nbsp;to&nbsp;retrieve&nbsp;all&nbsp;those&nbsp;vertices.&nbsp;While,&nbsp;I&nbsp;am&nbsp;sure&nbsp;you&nbsp;could&nbsp;write&nbsp;your&nbsp;own&nbsp;logic&nbsp;to&nbsp;implement&nbsp;it.&nbsp;Following&nbsp;is&nbsp;some&nbsp;code&nbsp;you&nbsp;can&nbsp;take&nbsp;a&nbsp;reference&nbsp;if&nbsp;you&nbsp;want.  
`        private Collection<Vertex> GetAllVertices(BaseShape baseShape)        {            Collection<Vertex> returningVertices = new Collection<Vertex>();            WellKnownType wellKnowType = baseShape.GetWellKnownType();            switch (wellKnowType)            {                case WellKnownType.Point:                    PointShape targetShape1 = (PointShape)baseShape;                    returningVertices.Add(new Vertex(targetShape1));                    break;                case WellKnownType.Multipoint:                    MultipointShape targetShape2 = (MultipointShape)baseShape;                    foreach (PointShape pointShape in targetShape2.Points)                    {                        returningVertices.Add(new Vertex(pointShape));                    }                    break;                case WellKnownType.Line:                    //logic for LineShape.                    break;                case WellKnownType.Multiline:                    //Logic for MultilineShape.                    break;                case WellKnownType.Polygon:                    //Logic for PolygonShape                    break;                case WellKnownType.Multipolygon:                    //Logic for MultiPolygon shape.                    break;                default:                    throw new ArgumentException("baseshape is not a valid shape");            }            return returningVertices;        }`  
&nbsp;  
  
Any&nbsp;more&nbsp;questions&nbsp;just&nbsp;feel&nbsp;free&nbsp;to&nbsp;let&nbsp;me&nbsp;know.  
&nbsp;  
Thanks.  
&nbsp;  
Yale
