ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Geometry Namespace / CubicBezierBuilderEx Class / CreateCubicBezierSegment Method / CreateCubicBezierSegment(MapPoint,Coordinate2D,Coordinate2D,MapPoint,SpatialReference) Method
The start point.
Control point 1 of the cubic bezier.
Control point 2 of the cubic bezier.
The end point.
(Optional) The spatial reference. The default value is null. The spatial references of the input points are ignored.
Example

In This Topic
    CreateCubicBezierSegment(MapPoint,Coordinate2D,Coordinate2D,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 startPoint As MapPoint, _
       ByVal controlPoint1 As Coordinate2D, _
       ByVal controlPoint2 As Coordinate2D, _
       ByVal endPoint As MapPoint, _
       Optional ByVal spatialReference As SpatialReference _
    ) As CubicBezierSegment

    Parameters

    startPoint
    The start point.
    controlPoint1
    Control point 1 of the cubic bezier.
    controlPoint2
    Control point 2 of the cubic bezier.
    endPoint
    The end point.
    spatialReference
    (Optional) The spatial reference. The default value is null. The spatial references of the input points are ignored.
    Exceptions
    ExceptionDescription
    startPoint or controlPoint1 or controlPoint2 or endPoint is null or empty.
    Example
    Construct a Cubic Bezier - from Coordinates
    {
      // Use a builderEx convenience method or a builderEx constructor.
    
      MapPoint startPt = MapPointBuilderEx.CreateMapPoint(1.0, 1.0, 3.0);
      MapPoint endPt = MapPointBuilderEx.CreateMapPoint(2.0, 2.0, 3.0);
    
      Coordinate2D ctrl1Pt = new Coordinate2D(1.0, 2.0);
      Coordinate2D ctrl2Pt = new Coordinate2D(2.0, 1.0);
    
      // BuilderEx convenience methods don't need to run on the MCT
      CubicBezierSegment bezier = CubicBezierBuilderEx.CreateCubicBezierSegment(startPt, ctrl1Pt, ctrl2Pt, endPt, SpatialReferences.WGS84);
    
      // without a SR
      bezier = CubicBezierBuilderEx.CreateCubicBezierSegment(startPt, ctrl1Pt, ctrl2Pt, endPt);
    
    
      // builderEx constructors don't need to run on the MCT
      CubicBezierBuilderEx cbbEx = new CubicBezierBuilderEx(startPt, ctrl1Pt, ctrl2Pt, endPt);
      bezier = cbbEx.ToSegment() as CubicBezierSegment;
    
      // another alternative
      cbbEx = new CubicBezierBuilderEx(startPt, ctrl1Pt.ToMapPoint(), ctrl2Pt.ToMapPoint(), endPt);
      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