ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Geometry Namespace / CubicBezierBuilderEx Class / CreateCubicBezierSegment Method / CreateCubicBezierSegment(IEnumerable<MapPoint>,SpatialReference) Method
The enumeration of points from which the curve will be constructed. Four points must be supplied.
(Optional) The spatial reference. The default value is null. The spatial references of the input points are ignored.
Example

In This Topic
    CreateCubicBezierSegment(IEnumerable<MapPoint>,SpatialReference) Method
    In This Topic
    Convenience method to create a new instance of the CubicBezierSegment class from four control points.
    Syntax
    Public Overloads Shared Function CreateCubicBezierSegment( _
       ByVal points As IEnumerable(Of MapPoint), _
       Optional ByVal spatialReference As SpatialReference _
    ) As CubicBezierSegment

    Parameters

    points
    The enumeration of points from which the curve will be constructed. Four points must be supplied.
    spatialReference
    (Optional) The spatial reference. The default value is null. The spatial references of the input points are ignored.
    Exceptions
    ExceptionDescription
    Four points are required for a cubic bezier.
    points is null or one of the 4 points is null or empty.
    Remarks
    The four points of the cubic bezier segment. points[0] is the start point, points[1] and points[2] are the control points, and points[3] is the end point.
    Example
    Construct a Cubic Bezier - from an enumeration of MapPoints
    {
      // Use a buildeExr convenience method or use a builderEx constructor.
    
      MapPoint startPt = MapPointBuilderEx.CreateMapPoint(1.0, 1.0, SpatialReferences.WGS84);
      MapPoint endPt = MapPointBuilderEx.CreateMapPoint(2.0, 2.0, SpatialReferences.WGS84);
    
      MapPoint ctrl1Pt = MapPointBuilderEx.CreateMapPoint(1.0, 2.0, SpatialReferences.WGS84);
      MapPoint ctrl2Pt = MapPointBuilderEx.CreateMapPoint(2.0, 1.0, SpatialReferences.WGS84);
    
      List<MapPoint> listMapPoints = new List<MapPoint>();
      listMapPoints.Add(startPt);
      listMapPoints.Add(ctrl1Pt);
      listMapPoints.Add(ctrl2Pt);
      listMapPoints.Add(endPt);
    
      // BuilderEx convenience methods don't need to run on the MCT
      CubicBezierSegment bezier = CubicBezierBuilderEx.CreateCubicBezierSegment(listMapPoints);
    
      // builderEx constructors don't need to run on the MCT
      CubicBezierBuilderEx cbbEx = new CubicBezierBuilderEx(listMapPoints);
      bezier = cbbEx.ToSegment() as CubicBezierSegment;
    }
    Create Bezier Curve Element
    {
      //Note: Must be on QueuedTask.Run
      //Build geometry
      Coordinate2D pt1 = new Coordinate2D(1, 7.5);
      Coordinate2D pt2 = new Coordinate2D(1.66, 8);
      Coordinate2D pt3 = new Coordinate2D(2.33, 7.1);
      Coordinate2D pt4 = new Coordinate2D(3, 7.5);
      var bez = new CubicBezierBuilderEx(pt1, pt2, pt3, pt4);
      var bezSeg = bez.ToSegment();
      Polyline bezPl = PolylineBuilderEx.CreatePolyline(bezSeg, AttributeFlags.AllAttributes);
    
      //Set symbology, create and add element to layout
      CIMLineSymbol lineSym = SymbolFactory.Instance.ConstructLineSymbol(
        ColorFactory.Instance.RedRGB, 4.0, SimpleLineStyle.DashDot);
    
      ElementFactory.Instance.CreateGraphicElement(layout, bezPl, lineSym, "New Bezier");
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also