I am migrating .NET code that was running against 9.3, to make it work for 10.1.
There is part of the code that is failing when migrate to 10.1 and was working on 9.3
The code was doing intersect twice.
The code is like this
The intersection method is wrapped into this method
So the code is calling this method twice
The code is failing on the second statement,
and more specifically when we are calling the intersect method
targetOperator.Intersect(localSourceGeometry, localSourceGeometry.Dimension);
and giving this error
Error HRESULT E_FAIL has been returned from a call to a COM component.
System.Runtime.InteropServices.ExternalException {System.Runtime.InteropServices.COMException}
HResult = -2147467259
There is part of the code that is failing when migrate to 10.1 and was working on 9.3
The code was doing intersect twice.
The code is like this
The intersection method is wrapped into this method
Code:
public IGeometry GetOverlappedGeometry(IGeometry sourceGeometry, IGeometry targetGeometry)
{
IGeometry overlappedGeometry = null;
if (!IsNullOrEmptyGeometry(sourceGeometry) && !IsNullOrEmptyGeometry(targetGeometry) && IsGeometryIntersect(sourceGeometry, targetGeometry))
{
IGeometry localSourceGeometry;
IGeometry localTargetGeometry;
if (sourceGeometry.GeometryType > targetGeometry.GeometryType)
{
localSourceGeometry = targetGeometry;
localTargetGeometry = sourceGeometry;
}
else
{
localSourceGeometry = sourceGeometry;
localTargetGeometry = targetGeometry;
}
ITopologicalOperator targetOperator = localTargetGeometry as ITopologicalOperator;
if (targetOperator != null)
{
targetOperator.Simplify();
IGeometry intersectGeometry = targetOperator.Intersect(localSourceGeometry, localSourceGeometry.Dimension);
if (!IsNullOrEmptyGeometry(intersectGeometry))
{
overlappedGeometry = intersectGeometry;
}
}
}
return overlappedGeometry;
}
Code:
IGeometry overlapped1 = GetOverlappedGeometry(geom1, geom2);
-- where geom1 is PolylineClass, and geom2 is PolygonClass;
IGeometry overlappe2 = GetOverlappedGeometry(geom2, overlapped1);
-- where geom2 is PolylineClass
The code is failing on the second statement,
and more specifically when we are calling the intersect method
targetOperator.Intersect(localSourceGeometry, localSourceGeometry.Dimension);
and giving this error
Error HRESULT E_FAIL has been returned from a call to a COM component.
System.Runtime.InteropServices.ExternalException {System.Runtime.InteropServices.COMException}
HResult = -2147467259