ArcGIS Pro 3.4 API Reference Guide
ArcGIS.Core.Geometry Namespace / PolylineBuilderEx Class / CreatePolyline Method / CreatePolyline(MapPoint,Double,Double,Double,ArcOrientation,ClothoidCreateMethod,Double,CurveDensifyMethod,Double,SpatialReference) Method
The start point of the polyline.
The tangent direction of the spiral, north azimuth, at the first point of the spiral. The unit of the azimuth is radians.
The radius at the start of the spiral. The radius must be greater than zero. Double.Infinity is a valid value for the radius.
The radius at the end of the spiral. The radius must be greater than zero. Double.Infinity is a valid value for the radius.
The orientation of the spiral.
The method of creation. ClothoidCreateMethod.ByLength signifies that lengthOrAngle specifies the length of the entire spiral. ClothoidCreateMethod.ByAngle signifies that lengthOrAngle specifies the angle, in radians, measuring the span of the arc from the start to the end of the clothoid path.
Either the length of the clothoid or the central angle of the clothoid as specified by createMethod.
The method of densification.
If densifyMethod is CurveDensifyMethod.ByLength, then curveDensity is the maximum segment length allowed in the clothoid. If densifyMethod is CurveDensifyMethod.ByDeviation, then curveDensity is the maximum distance, in meters, that the clothoid can deviate from the actual curve. If densifyMethod is CurveDensifyMethod.ByAngle, then curveDensity is the maximum angle between tangent lines to the curve.
(Optional) The spatial reference of the polyline. The default value is null.
Example

In This Topic
    CreatePolyline(MapPoint,Double,Double,Double,ArcOrientation,ClothoidCreateMethod,Double,CurveDensifyMethod,Double,SpatialReference) Method
    In This Topic
    Creates new instance of the Polyline class that is a linear approximation to a clothoid.
    Syntax

    Parameters

    startPoint
    The start point of the polyline.
    startTangentDirection
    The tangent direction of the spiral, north azimuth, at the first point of the spiral. The unit of the azimuth is radians.
    startRadius
    The radius at the start of the spiral. The radius must be greater than zero. Double.Infinity is a valid value for the radius.
    endRadius
    The radius at the end of the spiral. The radius must be greater than zero. Double.Infinity is a valid value for the radius.
    orientation
    The orientation of the spiral.
    createMethod
    The method of creation. ClothoidCreateMethod.ByLength signifies that lengthOrAngle specifies the length of the entire spiral. ClothoidCreateMethod.ByAngle signifies that lengthOrAngle specifies the angle, in radians, measuring the span of the arc from the start to the end of the clothoid path.
    lengthOrAngle
    Either the length of the clothoid or the central angle of the clothoid as specified by createMethod.
    densifyMethod
    The method of densification.
    curveDensity
    If densifyMethod is CurveDensifyMethod.ByLength, then curveDensity is the maximum segment length allowed in the clothoid. If densifyMethod is CurveDensifyMethod.ByDeviation, then curveDensity is the maximum distance, in meters, that the clothoid can deviate from the actual curve. If densifyMethod is CurveDensifyMethod.ByAngle, then curveDensity is the maximum angle between tangent lines to the curve.
    spatialReference
    (Optional) The spatial reference of the polyline. The default value is null.
    Remarks
    A clothoid, also known as an Euler spiral, is a curve such that its curvature is equal to a constant times its length. Curvature is a value that measures how curved or flat the curve is at a point. The larger the curvature, the more flat the curve is. The curvature is equal to the reciprocal of the radius. If the radius is infinity, then the curvature is zero. i.e. flat.

    Shown below is a clothoid with startTangentDirection = 0, startRadius = double.PositiveInfinity, endRadius = 1, orientation = ArcOrientation.ArcCounterClockwise, createMethod = ClothoidCreateMethod.ByLength, and lengthOrAngle = 10.

    Clothoid1

    Here is a clothoid with startTangentDirection = Math.PI / 4, startRadius = double.PositiveInfinity, endRadius = 0.8, orientation = ArcOrientation.ArcClockwise, createMethod = ClothoidCreateMethod.ByLength, and lengthOrAngle = 10.

    Clothoid2

    Now here is a clothoid such that the start radius is smaller than the end radius. It has startTangentDirection = Math.PI / 3, startRadius = 2, endRadius = 10, orientation = ArcOrientation.ArcClockwise, createMethod = ClothoidCreateMethod.ByLength, and lengthOrAngle = 20.

    Clothoid3
    Example
    Construct a Clothoid by Angle
    MapPoint startPoint = MapPointBuilderEx.CreateMapPoint(0, 0);
    double tangentDirection = Math.PI / 6;
    ArcOrientation orientation = ArcOrientation.ArcCounterClockwise;
    double startRadius = double.PositiveInfinity;
    double endRadius = 0.2;
    ClothoidCreateMethod createMethod = ClothoidCreateMethod.ByAngle;
    double angle = Math.PI / 2;
    CurveDensifyMethod densifyMethod = CurveDensifyMethod.ByLength;
    double densifyParameter = 0.1;
    
    Polyline polyline = PolylineBuilderEx.CreatePolyline(startPoint, tangentDirection, startRadius, endRadius, orientation, createMethod, angle, densifyMethod, densifyParameter, SpatialReferences.WGS84);
    
    int numPoints = polyline.PointCount;
    MapPoint queryPoint = polyline.Points[numPoints - 2];
    
    MapPoint pointOnPath;
    double radiusCalculated, tangentDirectionCalculated, lengthCalculated, angleCalculated;
    
    PolylineBuilderEx.QueryClothoidParameters(queryPoint, startPoint, tangentDirection, startRadius, endRadius, orientation, createMethod, angle, out pointOnPath, out radiusCalculated, out tangentDirectionCalculated, out lengthCalculated, out angleCalculated, SpatialReferences.WGS84);
    
    Create_freehand
    //Create a graphic freehand element with a simple line style.
    
    //Construct on the worker thread
    await QueuedTask.Run(() =>
    {
      //Build geometry
      List<Coordinate2D> plCoords = new List<Coordinate2D>();
      plCoords.Add(new Coordinate2D(1.5, 10.5));
      plCoords.Add(new Coordinate2D(1.25, 9.5));
      plCoords.Add(new Coordinate2D(1, 10.5));
      plCoords.Add(new Coordinate2D(0.75, 9.5));
      plCoords.Add(new Coordinate2D(0.5, 10.5));
      plCoords.Add(new Coordinate2D(0.5, 1));
      plCoords.Add(new Coordinate2D(0.75, 2));
      plCoords.Add(new Coordinate2D(1, 1));
      //At 2.x - Polyline linePl = PolylineBuilder.CreatePolyline(plCoords);
      Polyline linePl = PolylineBuilderEx.CreatePolyline(plCoords);
    
      //Set symbolology, create and add element to layout
      CIMLineSymbol lineSym = SymbolFactory.Instance.ConstructLineSymbol(ColorFactory.Instance.BlackRGB, 2.0, SimpleLineStyle.Solid);
      //At 2.x - GraphicElement lineElm = LayoutElementFactory.Instance.CreateLineGraphicElement(layout, linePl, lineSym);
      //         lineElm.SetName("New Freehand"); 
      GraphicElement lineElm = ElementFactory.Instance.CreateGraphicElement(layout, linePl, lineSym, "New Freehand");
    });
    Create_ellipse
    //Create an ellipse graphic with simple line and fill styles.
    
    //Construct on the worker thread
    await QueuedTask.Run(() =>
    {
      //Build geometry
      Coordinate2D center = new Coordinate2D(2, 2.75);
      //At 2.x - EllipticArcBuilder eabElp = new EllipticArcBuilder(center, 0, 1, 0.45, esriArcOrientation.esriArcClockwise);
      var eabElp = new EllipticArcBuilderEx(center, 0, 1, 0.45, ArcOrientation.ArcClockwise);
      EllipticArcSegment ellipse = eabElp.ToSegment();
    
      //Set symbolology, create and add element to layout
      CIMStroke outline = SymbolFactory.Instance.ConstructStroke(ColorFactory.Instance.GreenRGB, 2.0, SimpleLineStyle.Dot);
      CIMPolygonSymbol ellipseSym = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.GreyRGB, SimpleFillStyle.Vertical, outline);
      //At 2.x - GraphicElement elpElm = LayoutElementFactory.Instance.CreateEllipseGraphicElement(layout, ellipse, ellipseSym);
      //         elpElm.SetName("New Ellipse");
    
      var polyLine = PolylineBuilderEx.CreatePolyline(ellipse);
      GraphicElement elpElm = ElementFactory.Instance.CreateGraphicElement(layout, polyLine, ellipseSym, "New Ellipse");
    });
    Create_CurveText
    //Create curve text with basic text properties.
    
    //Construct on the worker thread
    await QueuedTask.Run(() =>
    {
      //Build geometry
      Coordinate2D pt1 = new Coordinate2D(3.6, 7.5);
      Coordinate2D pt2 = new Coordinate2D(4.26, 8);
      Coordinate2D pt3 = new Coordinate2D(4.93, 7.1);
      Coordinate2D pt4 = new Coordinate2D(5.6, 7.5);
      //At 2.x - CubicBezierBuilder bez = new CubicBezierBuilder(pt1, pt2, pt3, pt4);
      var bez = new CubicBezierBuilderEx(pt1, pt2, pt3, pt4);
      CubicBezierSegment bezSeg = bez.ToSegment();
      //At 2.x - Polyline bezPl = PolylineBuilder.CreatePolyline(bezSeg);
      Polyline bezPl = PolylineBuilderEx.CreatePolyline(bezSeg);
    
      //Set symbolology, create and add element to layout
      CIMTextSymbol sym = SymbolFactory.Instance.ConstructTextSymbol(ColorFactory.Instance.BlackRGB, 24, "Comic Sans MS", "Regular");
      //At 2.x - GraphicElement bezTxtElm = LayoutElementFactory.Instance.CreateCurvedTextGraphicElement(layout, bezPl, "Curved Text", sym);
      //         bezTxtElm.SetName("New Splinned Text");
      GraphicElement bezTxtElm = ElementFactory.Instance.CreateTextGraphicElement(
                                    layout, TextType.SplinedText, bezPl, sym, "Curved Text", "New Splinned Text");
    });
    Create Lasso Line, Freehand Graphic Element
    //Must be on QueuedTask.Run(() => { ...
    
    //Build geometry
    List<Coordinate2D> plCoords = new List<Coordinate2D>();
    plCoords.Add(new Coordinate2D(1.5, 10.5));
    plCoords.Add(new Coordinate2D(1.25, 9.5));
    plCoords.Add(new Coordinate2D(1, 10.5));
    plCoords.Add(new Coordinate2D(0.75, 9.5));
    plCoords.Add(new Coordinate2D(0.5, 10.5));
    plCoords.Add(new Coordinate2D(0.5, 1));
    plCoords.Add(new Coordinate2D(0.75, 2));
    plCoords.Add(new Coordinate2D(1, 1));
    Polyline linePl = PolylineBuilderEx.CreatePolyline(plCoords);
    
    //Set symbology, create and add element to layout
    CIMLineSymbol lineSym = SymbolFactory.Instance.ConstructLineSymbol(
              ColorFactory.Instance.BlackRGB, 2.0, SimpleLineStyle.Solid);
    //var graphic = GraphicFactory.Instance.CreateShapeGraphic(linePl, lineSym);
    
    var ge = ElementFactory.Instance.CreateGraphicElement(
                            container, linePl, lineSym, "New Freehand");
    Create Line Element
    //Must be on QueuedTask.Run(() => { ...
    
    //Build geometry
    List<Coordinate2D> plCoords = new List<Coordinate2D>();
    plCoords.Add(new Coordinate2D(1, 8.5));
    plCoords.Add(new Coordinate2D(1.66, 9));
    plCoords.Add(new Coordinate2D(2.33, 8.1));
    plCoords.Add(new Coordinate2D(3, 8.5));
    Polyline linePl = PolylineBuilderEx.CreatePolyline(plCoords);
    
    //Reference a line symbol in a style
    var ProjectStyles = Project.Current.GetItems<StyleProjectItem>();
    StyleProjectItem style = ProjectStyles.First(x => x.Name == "ArcGIS 2D");
    var symStyle = style.SearchSymbols(StyleItemType.LineSymbol, "Line with 2 Markers")[0];
    CIMLineSymbol lineSym = symStyle.Symbol as CIMLineSymbol;
    lineSym.SetSize(20);
    
    //Set symbology, create and add element to layout
    //CIMLineSymbol lineSym = SymbolFactory.Instance.ConstructLineSymbol(ColorFactory.Instance.BlueRGB, 4.0, SimpleLineStyle.Solid);
    ElementFactory.Instance.CreateGraphicElement(
      container, linePl, lineSym, "New Line");
    
    Requirements

    Target Platforms: Windows 11, Windows 10

    ArcGIS Pro version: 3 or higher.
    See Also