Fix by rebuilding geometry in arcobjects & perform ITopologicalOperator.Simplify. (TODO: set MAware, ZAware, M's and/or Z's)
private IFeatureClass FixArcGisDoubleLinesBug(IFeatureClass unsplitFeatureClass)
{
IFeatureCursor updateFeatureCursor = unsplitFeatureClass.Update(null, false);
try
{
for (IFeature feature = updateFeatureCursor.NextFeature(); feature != null; feature = updateFeatureCursor.NextFeature())
{
IGeometry srcGeometry = feature.ShapeCopy;
var srcPointCollection = srcGeometry as IPointCollection;
IPath targetPath = new PathClass();
var targetPointCollection = targetPath as IPointCollection;
object missing = Type.Missing;
for (int i = 0; i < srcPointCollection.PointCount; i++)
{
IPoint aPoint = new PointClass();
aPoint.X = srcPointCollection.Point.X;
aPoint.Y = srcPointCollection.Point.Y;
targetPointCollection.AddPoint(aPoint, ref missing, ref missing);
}
IPolyline targetPolyline = new PolylineClass();
var targetPolylineGeometries = targetPolyline as IGeometryCollection;
targetPolylineGeometries.AddGeometry(targetPath as IGeometry, ref missing, ref missing);
ITopologicalOperator topologicalOperator = targetPolyline as ITopologicalOperator;
topologicalOperator.Simplify();
feature.Shape = targetPolyline;
updateFeatureCursor.UpdateFeature(feature);
}
}
finally
{
if (updateFeatureCursor != null)
Marshal.FinalReleaseComObject(updateFeatureCursor);
}