pavsanto

Save a Geometry (draw using Rubberband) as a feature in Feature Class

Discussion created by pavsanto on Apr 20, 2013
Latest reply on Apr 22, 2013 by pavsanto
Namaste, Hola, Hi

Using the Code below I have created a Line geometry using Rubberbanding

public void DrawPolyline(ESRI.ArcGIS.Carto.IActiveView activeView)
{
if(activeView == null)
{
return;
}
ESRI.ArcGIS.Display.IScreenDisplay screenDisplay = activeView.ScreenDisplay;

screenDisplay.StartDrawing(screenDisplay.hDC, (System.Int16)ESRI.ArcGIS.Display.esriScreenCache.esriNoScreenCache); // Explicit Cast
ESRI.ArcGIS.Display.IRgbColor rgbColor = new ESRI.ArcGIS.Display.RgbColorClass();
rgbColor.Red = 255;

ESRI.ArcGIS.Display.IColor color = rgbColor; // Implicit Cast
ESRI.ArcGIS.Display.ISimpleLineSymbol simpleLineSymbol = new ESRI.ArcGIS.Display.SimpleLineSymbolClass();
simpleLineSymbol.Color = color;

ESRI.ArcGIS.Display.ISymbol symbol = (ESRI.ArcGIS.Display.ISymbol)simpleLineSymbol; // Explicit Cast
ESRI.ArcGIS.Display.IRubberBand rubberBand = new ESRI.ArcGIS.Display.RubberLineClass();
ESRI.ArcGIS.Geometry.IGeometry geometry = rubberBand.TrackNew(screenDisplay, symbol);
screenDisplay.SetSymbol(symbol);
screenDisplay.DrawPolyline(geometry);
screenDisplay.FinishDrawing();
}

After Drawing a Line geometry using Rubberband, I would like to save the "geometry" as a feature in a FeatureClass and create a Feature Layer and display the layer. I am facing trouble in creating feature class and saving a feature. Please help me with some sample Code .. I am badly waiting for some reply.

Thanks and Regards,
Pavan

Outcomes