Dear All
I am working now on ArcObject .Net to develop an gis application , i need your help in certain area , i can now get Polygon corner (vertices ) but how i can show the corner /vertices as graphic with it's label .
Thanks
any help or advice Plz.
This what i meant :
Hi Najad,
Have look at AddTextElement method in this sample ArcObjects 10 .NET SDK Help .
Iterate through your polygon vertices by casting it as IPointCollection to get vertex geometry.
Here is a small piece of code that does what you need. The code should work as it is pretty simple and I have not tested even for compilation. But this should get you started with ArcObjects.
//Get the Polygon from the Feature.Shape property
public void AddPolygonVertexText(IMap map, IPolygon polygon)
{
IPointCollection ptCollection = (IPointCollection)polygon;
IPoint outPoint=new PointClass();
IGraphicsContainer graphicsContainer = map as IGraphicsContainer;
IElement txtElement=null;
for(int ptCount=0;ptCount<ptCollection.PointCount;ptCount++)
{
ptCollection.QueryPoint(ptCount,outPoint);
GetTextElement(outPoint,ptCount+1);
graphicsContainer.AddElement(element, 0);
}
((IActiveView)map).PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
}
//Creates a TextElement and sends the result to the calling class
private ITextElement AddTextElement(IPoint pt,string labelTxt)
{
IElement element = new TextElementClass();
ITextElement textElement = element as ITextElement;
IPoint point = new PointClass();
point.X = pt.X;
point.Y = pt.Y;
element.Geometry = point;
textElement.Text = labelText;
return textElement;
}