protected override void OnMouseDown(ESRI.ArcGIS.Desktop.AddIns.Tool.MouseEventArgs arg)
{
//create geometery
if (ArcMap.Document != null)
{
IScreenDisplay screenDisplay = ArcMap.Document.ActiveView.ScreenDisplay;
// Constants
screenDisplay.StartDrawing(screenDisplay.hDC, (System.Int16)esriScreenCache.esriNoScreenCache);
// Explicit Cast
IRgbColor rgbColor = new RgbColorClass();
rgbColor.Red = 255;
rgbColor.Transparency = 75;
IColor color = rgbColor; // Implicit Cast
ISimpleFillSymbol simpleFillSymbol = new SimpleFillSymbolClass();
simpleFillSymbol.Color = color;
//Draw geometry
ISymbol symbol = simpleFillSymbol as ISymbol; // Dynamic Cast
IRubberBand rubberBand = new RubberPolygonClass();
IGeometry geometry = rubberBand.TrackNew(screenDisplay, symbol);
//check for valid geometery
if (geometry != null)
{
screenDisplay.SetSymbol(symbol);
screenDisplay.DrawPolygon(geometry);
screenDisplay.FinishDrawing();
//Open addattributes wpf form
AddAtrributesView addAtrributesView = new AddAtrributesView(geometry);
addAtrributesView.ShowInTaskbar = false;
addAtrributesView.ShowDialog();
ArcMap.Document.ActivatedView.Refresh();
}
}
}
0 comments :
Post a Comment