Hello Steve,
Sorry for waiting, this problem connect to some other question, so it cost a lot time.
when I invoked CalculateAllControlPoints function, I found that the internal features’ RTree had been rebuilt. However, after I did some operation to these features I didn’t recall “BuildIndex” method. And these new features are not included in RTree dictionary. It will throw the exception when I got features by RTree index.
We have two solution for this issue:
1. The CalculateAllControlPoints should be invoked after the internal features have been changed, because the BuildIndex would be invoked, the RTree index would be reconstructed. The codes snipped as follows:
winformsMap1.EditOverlay.EditShapesLayer.InternalFeatures.Clear();
// need this to clear edit drag/resize controls
winformsMap1.EditOverlay.ExistingControlPointsLayer.InternalFeatures.Clear();
winformsMap1.EditOverlay.ResizeControlPointsLayer.InternalFeatures.Clear();
winformsMap1.EditOverlay.RotateControlPointsLayer.InternalFeatures.Clear();
winformsMap1.EditOverlay.DragControlPointsLayer.InternalFeatures.Clear();
winformsMap1.EditOverlay.CalculateAllControlPoints();
winformsMap1.Refresh(new Overlay[] { winformsMap1.EditOverlay });
2. we can solve the issue with BeginTransaction and CommitTransaction. The codes snipped as follows:
winformsMap1.EditOverlay.DragControlPointsLayer.Open();
winformsMap1.EditOverlay.DragControlPointsLayer.FeatureSource.BeginTransaction();
winformsMap1.EditOverlay.DragControlPointsLayer.InternalFeatures.Clear();
winformsMap1.EditOverlay.DragControlPointsLayer.FeatureSource.CommitTransaction();
winformsMap1.EditOverlay.DragControlPointsLayer.Close();
Please let us know if you still can't let it work.
Regards,
Gary