Is this something that can be done?
For instance if I created an overlay on a map and saved it as a shape file, I want to go and edit this (pre-existing file.) overlay...Either add points/remove points change color/fillstyle/etc.
Ideally I want to avoid creating a new shp file and deleting the old one.
Thoughts?
Edit 1: OK, now that someone has said it can be done. The obvious question is How do you edit the shape file (in ArcObjects pro-grammatically)
Edit 2: Looking at comments it appears I need to do something like this, but I'm not sure.
I currently have a basic shapefile that I want to edit in ArcObjects in C#.
I've created a shape file by creating a FeatureClass , Workspace and then obviously passing in my shape. In this case it's just a simple Polyline with a few points on it. What I'd like to do is have the ability to update this shapefile.
I'm assuming I need to re-use that FeatureClass, Workspace and pass in a new shape. However, what I'm doing doesn't seem to work. This is where I'm at on the edit - any advice would be great.
IWorkspaceEdit workspaceEdit = (IWorkspaceEdit)inWorkspace;
workspaceEdit.StartEditing(true);
workspaceEdit.StartEditOperation();
ComReleaser comReleaser = new ComReleaser();
IFeatureCursor featureCursor = inFeatureClass.Update(null , true);
IFeature feature = null;
while((feature = featureCursor.NextFeature()) != null)
{
int id = feature.Fields.FindField("shape");
IFeatureBuffer featureBuffer = inFeatureClass.CreateFeatureBuffer();
featureCursor.DeleteFeature(); //Delete the old
featureBuffer.Shape = (IGeometry)inShape;
featureCursor.InsertFeature(featureBuffer);
}
workspaceEdit.StopEdidtOperation();
workspaceEdit.StopEditing(true);
EDIT 3: Final Solution
featureCursor = inFeatureClass.Update(null ,true);
//DELETE old shape
featureCursor = inFeatureClass.Insert(true);
//Insert new
workspaceEdit.StopEditOperation();
workspaceEdit.StopEditing(true);