I am experiencing a frustrating problem trying to add a vertex to an exiting line. My scenario is I am tracking a changing point coordinate and I want to create a bread crumb trail behind the moving point. I create a line with the first two points and then I attempt to simply append to that line. The approach I am using is lopping through this code as I add vertexes to a collection from coordinates obtained from my tracking point.:
Feature feat;
LineShape lineShape = null;
lineLayer.Open();
lineLayer.EditTools.BeginTransaction();
//get the feature and append vertex from last vertex collected in my vertex collection
feat = lineLayer.FeatureSource.GetFeatureById("mission",ReturningColumnsType.NoColumns);
lineShape = feat.GetShape() as LineShape;
lineShape.Vertices.Add(_vertexes.Last());
lineLayer.EditTools.CommitTransaction();
lineLayer.Close();
My initial line shape is created from my first two vertexes. Then it loops this code to add additional vertexes. When I add the third vertex to lineShape, I can examine lineShape and see it has three vertexes. The problem is when it loops, derives a new lineSHape from the feature and trys to add the fourth vertex, lineShape only has two vertices again. What do I have to do to get lineShape to persist the added vertex in the feature? It has to be something simple I am missing. Any Help? Thanks.
Eric