problems with editdeleteshape() in 4.7 version

Apr 29, 2011 at 10:29 AM

Hi,

in my application, i clear the shapefile using the editdeleteshape(), passing as parameter the index of the shape i want to delete.

I have problem with a shapefile: i have the error "index out of bounds"when i perform a shape delete, but in shape creation i pass the shape index and i store it in an array to reuse it in delete action...

any suggestion?

thanks

Apr 29, 2011 at 4:57 PM

Try this.

  myshafile.StartEditingShapes(true, null);
  myshafile.EditDeleteShape(index);
  myshafile.StopEditingShapes(true, true, null);
  myshafile.ClearDrawing(handle);
  myshafile.CursorMode = MapWinGIS.tkCursorMode.cmNone;
  myshafile.Redraw();

May 4, 2011 at 12:54 PM

thanks!

i've resolved the problem deleting the shapefile starting from last shape to first...i don't know why, but it works!

May 31, 2011 at 10:02 PM

Just like when using an iterator, removing items from the collection can alter an items position.  When a shape is deleted, the index of the rest of the shapes located after the deleted shape change.  If you have a list of shape indices that need deleted, the indexes need to be deleted from largest to smallest.

 

-Sam