Я использую этот код для рисования многоугольника в ArcMap в ArcGIS, но я не могу найти координаты всех вершин.
private bool isPolygonDrawn = false;
public void drawPolygon(ESRI.ArcGIS.Carto.IActiveView activeView)
{
if (activeView == null)
{
return;
}
IScreenDisplay screenDisplay = activeView.ScreenDisplay;
screenDisplay.StartDrawing(screenDisplay.hDC, (System.Int16)esriScreenCache.esriNoScreenCache);
IRgbColor rgbColor = new RgbColor();
rgbColor.Blue = 255;
IColor color = rgbColor;
ISimpleLineSymbol simpleLineSymbol = new SimpleLineSymbol();
simpleLineSymbol.Color = color;
ISymbol symbol = (ESRI.ArcGIS.Display.ISymbol)simpleLineSymbol;
IRubberBand rubberBand = new RubberPolygon();
//IPoint point = new PointClass();
// IPoint[] pointArray = screenDisplay.DisplayTransformation.ToMapPoint(.X , .Y);
IPolygon ppolygon = rubberBand.TrackNew(screenDisplay, null) as IPolygon;
IEnvelope en = ppolygon.Envelope;
screenDisplay.SetSymbol(symbol);
screenDisplay.DrawPolyline(ppolygon);
isPolygonDrawn = true;
screenDisplay.FinishDrawing();
activeView.Refresh();
}
protected override void OnMouseDown(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)
{
base.OnMouseDown(arg);
IDocument Doc = ArcMap.Application.Document;
IMxDocument mxDoc = (IMxDocument)Doc;
if (!isPolygonDrawn)
{
drawPolygon(mxDoc.ActiveView);
}
}
Пожалуйста, кто-нибудь поможет найти решение. Спасибо!