Selected Features

795
5
01-16-2013 06:27 PM
ArunYegi
New Contributor
Hi,

I want to create buffer only for selected features which are selected from "select feature tool".
How to do it using c#.net?

Thanks and Regards,
Arun
0 Kudos
5 Replies
ArunYegi
New Contributor
Someone plz help me...
0 Kudos
MarcinDruzgala
Occasional Contributor
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#//002m000003v8000000

You have .NET Snippets at the bottom of the page check it after you read the documentation.

Cheers
MDruzgala
0 Kudos
ArunYegi
New Contributor
Thanks for your help. That worked fine.
I have one more question.
What is the difference between creating buffer like this and creating by Execute method?

if i want to create buffer and display it on map using Execute method,how can i do it?

Thanks and Regards,
Arun
0 Kudos
MarcinDruzgala
Occasional Contributor
http://help.arcgis.com/en/sdk/10.0/arcobjects_net/conceptualhelp/index.html#//00010000041n000000

The first example:
public void IFeatureClassAsInput(IFeatureClass pFC, string buff_dist)
{
    IGeoProcessor2 gp = new GeoProcessorClass();
    gp.OverwriteOutput = true;
    IVariantArray parameters = new VarArrayClass();
    parameters.Add(pFC);
    parameters.Add(@"C:\temp\poitns_buff.shp");
    parameters.Add(buff_dist);
    gp.Execute("Buffer_analysis", parameters, null);
}


And this: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//000800000019000000

Cheers,
MDruzgala
0 Kudos
ArunYegi
New Contributor
Hi,

I have created a buffer as follows

IMap map = axMapControl1.ActiveView.FocusMap;
            IFeatureSelection fSelection = map.get_Layer(0) as IFeatureSelection;
           
            ISelectionSet selSet = fSelection.SelectionSet;
           
           
            ICursor cursor;
            selSet.Search(null, true, out cursor);

            IFeature feat = ((IFeatureCursor)cursor).NextFeature();
            ITopologicalOperator topoOpr = feat.Shape as ITopologicalOperator;

            IPolygon buffPolygon = topoOpr.Buffer(100) as IPolygon;

            IActiveView activeView=axMapControl1.ActiveView;
            IScreenDisplay screendispaly = activeView.ScreenDisplay;
            screendispaly.StartDrawing(screendispaly.hDC, (System.Int32)esriScreenCache.esriAllScreenCaches);
           

            ISimpleFillSymbol simFillSymbol = new SimpleFillSymbolClass() ;
            simFillSymbol.Style = esriSimpleFillStyle.esriSFSSolid;
            IRgbColor color = new RgbColorClass();
            color.Red = 255;
            simFillSymbol.Color = color;

            ISymbol symbol = simFillSymbol as ISymbol;
            screendispaly.SetSymbol(symbol);

            screendispaly.DrawPolygon(buffPolygon);


Now i can see a buffer around a feature.
I want to save it as a Feature class into data base.
How can i do it? Please help me out..

Thanks
0 Kudos