Select to view content in your preferred language

Runtime Geometry Engine vs. ArcGIS Core Geometry Engine

659
2
01-07-2023 02:23 PM
RodneyBunner
New Contributor

Hello,

I have an existing ArcObjects .NET stand alone application that I am converting to ArcGIS Runtime .NET.  In the ArcObjects application, I utilized many AO Geometry Engine methods such as  QueryPointAndDistance, QueryNormal, GetSubcurve and other methods which do not exist in the Runtime GeometryEngine.  A few questions related to this issue:

1.  Is there a native Runtime methodology to produce the same results as the methods listed above?

2.  If no to # 1, are there any plans to implement additional Runtime Geometry Engine methods such as those listed above? 

3.  If no to # 2, since the ArcGIS Core GeometryEngine contains the needed functions and the dll can be referenced in stand alone applications, does a methodology exist to convert Runtime Geometry objects to ArcGIS Core Geometry objects so that we can make use of the Core GeometryEngine functions?  

Thanks in advance,

Rodney

0 Kudos
2 Replies
XQ
by
Emerging Contributor

For #3, I can say no, since they are two separate SDKs and do not reference each other.

However, it is not difficult to write some codes to convert between Runtime and Pro geometries. They both use MapPoint, Multipoint, Polyline, and Polygon, and their properties are similar. Although they are using different methods to create geometries, it is easy to follow API documents.

0 Kudos
RodneyBunner
New Contributor

Thanks GeolTwinkle.  I did write my own GetSubcuve and QueryPointandDistance functions within Runtime to replicate the Core Geometry functions.  I haven't tested them extensively but they seem to work.  See below: 

public static void GetSubCurve(double fromDistance, double toDistance, Polyline inPolyline, ref Polyline outPolyline)
{

MapPoint nCreatepoint = GeometryEngine.CreatePointAlong(inPolyline, fromDistance);
MapPoint nCreatepoint2 = GeometryEngine.CreatePointAlong(inPolyline,toDistance);
List<MapPoint> mapPoints = new List<MapPoint>() { nCreatepoint, nCreatepoint2 };
PolylineBuilder pb = new PolylineBuilder(mapPoints);
Polyline nReshape = pb.ToGeometry();

Multipart nMP = GeometryEngine.Reshape(nReshape, inPolyline);
outPolyline = (Polyline)nMP;
}
public static void QueryPointandDistance(Polyline inPolyline, MapPoint inPoint, ref MapPoint outPoint, ref double distalong, ref double distFrom, ref bool bRight)
{
double dLength = GeometryEngine.Length(inPolyline);
double nFraction = GeometryEngine.FractionAlong(inPolyline, inPoint, -1);
distalong = dLength * nFraction;
outPoint = GeometryEngine.CreatePointAlong(inPolyline, distalong);
distFrom = outPoint.Distance(inPoint);

List<MapPoint> mapPoints = new List<MapPoint>() { inPoint, outPoint };
PolylineBuilder pb = new PolylineBuilder(mapPoints);
Polyline nReshape = pb.ToGeometry();
Geometry[] nGeom = GeometryEngine.Cut(nReshape, inPolyline);

if (nGeom is not null)
{ if (nGeom[0] is not null) bRight = false; }
{ if (nGeom[1] is not null) bRight = true; }
}

  

0 Kudos