This document is archived and information here might be outdated.  Recommended version.


Polyline Class (ArcObjects .NET 10.8 SDK)
ArcObjects Help for .NET developers > ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Classes > P > Polyline Class
ArcGIS Developer Help

PolylineClass Class

An ordered collection of paths; optionally has measure, height and ID attributes.

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Supported Platforms

Windows, Solaris, Linux

Extended Error Information

Use the ISupportErrorInfo method InterfaceSupportsErrorInfo to determine if the object supports extended error information. If the object supports extended error info, VC++ developers should use the OLE/COM IErrorInfo interface to access the ErrorInfo object. Visual Basic developers should use the global error object Err to retrieve this extended error information.

Interfaces

Interfaces Description
IClone (esriSystem) Provides access to members that control cloning of objects.
IConstructCurve Provides access to members that construct a curve using other geometries and measures.
IConstructCurve2 Provides access to members that construct a curve using other geometries and measures.
IConstructCurve3 Provides access to members that construct a curve using other geometries and measures.
IConstructGeodetic Provides access to members that construct various kinds of geodetic curves.
ICurve Provides access to properties and methods of all 1 dimensional curves (polylines, segments, boundaries of polygons, etc.).
ICurve2 Provides access to members that extend the functionality of one dimensional curves.
ICurve3 Provides access to members that extend the functionality of one dimensional curves.
ICurve3D Provides access to members that define operations common to curves with Zs.
IGeometry Provides access to members that describe properties and behavior of all geometric objects.
IGeometry2 Provides access to members that extend the IGeometry interface with a more sophisticated projection method.
IGeometry3 Provides rapid access to a geometry's extent in the x-y plane.
IGeometry4 Provides access to methods that indicate if a geometry has been changed (edited, projected, etc).
IGeometry5 Provides access to members that extend the IGeometry interface with a more sophisticated projection method.
IGeometryCollection Provides access to members that can be used for accessing, adding and removing individual geometries of a multi-part geometry (Multipoint, Polyline, Polygon, MultiPatch, and GeometryBag).
IHitTest Provides access to members that locate a part of a geometry closest to a point.
IHitTest3D Provides access to members that locate a part of a geometry closest to a point.
IMAware Indicator interface that identifies geometric objects that can have persistent M values attached to their vertices.
IMCollection Provides access to members that control operations on M-aware multipoints, polylines, polygons and multipatches.
IMSegmentation Provides access to members for defining an M-based linear coordinate system on a polyline or polygon.
IMSegmentation2 Provides access to additional linear referencing operations on polylines.
IMSegmentation3 Provides access to additional linear referencing operations on polylines.
IMSegmentation4 Provides access to additional linear referencing operations on polylines.
IMSnap Provides access to a method that snaps ms of the geometry to the precision of the spatial reference associated with the geometry.
IPersist (esriSystem)
IPersistStream (esriSystem)
IPointCollection Provides access to members that manipulate the points of a Multipoint, Path, Ring, Polyline, Polygon, TriangleFan, TriangleStrip, or MultiPatch.
IPointCollection4 Provides access to members that manipulate the points of a Multipoint, Path, Ring, Polyline, Polygon, TriangleFan, TriangleStrip, or MultiPatch.
IPointIDAware Indicator interface that identifies geometries that can have persistent point ID values attached to coordinates.
IPolycurve Provides access to members that define operations common to polylines and the boundaries of polygons.
IPolycurve2 Provides access to members that extend IPolycurve with additional splitting and densification methods.
IPolycurve3D Provides access to members that define operations common to polycurves with Zs.
IPolycurveGeodetic Provides various geodetic operations on curves.
IPolyline Provides access to members that identify and add behavior to a polyline object.
IPolyline2 Provides access to members that extend a polyline object.
IPolyline3 Provides access to members that extend a polyline object.
IPolyline4 Provides access to members that extend a polyline object.
IPolyline5 Provides access to members that extend a polyline object.
IProximityOperator Provides access to members that find the 2D distance between two geometries.
IProximityOperator3D Provides access to members that find the 3D distance between two geometries with Zs.
IRelationalOperator Provides access to members that determine if a certain spatial relationship exists between two geometries.
IRelationalOperator2 Additional relational functions.
IRelationalOperator3D Provides access to members that determine if a certain spatial relationship exists between two geometries with Zs.
IRelationalOperator3D2 Provides access to members that determine if a certain spatial relationship exists between two geometries with Zs.
ISegmentCollection Provides access to members that manipulate the segments of a path, ring, polyline, or polygon.
ISpatialIndex2 Provides access to members that create a temporary spatial index for improving performance of "Disjoint" and some other relational operators.
ISupportErrorInfo (esriSystem)
ITopologicalOperator Provides access to members for constructing new geometries based upon topological relationships between existing geometries.
ITopologicalOperator2 Provides access to members that extend the ITopologicalOperator interface.
ITopologicalOperator3 Provides additional information on non-simple geometries.
ITopologicalOperator5 Provides additional information on non-simple geometries.
ITopologicalOperator6 .
ITransform2D Provides access to methods for transforming geometries using either specific parameters or arbitrary transformation objects (affine transformations, geographic transformations, etc.).
ITransform3D Provides access to methods for transforming 3D geometries using either specific parameters or arbitrary transformation objects.
IXMLSerialize (esriSystem) Provides access to members that XML serialize and deserialize an object to/from XML.
IZ Provides access to members that identify geometric objects that can have 3D coordinates and defines operations on such objects.
IZ2 Provides access to additional members that identify geometric objects that can have 3D coordinates and defines operations on such objects.
IZAware Indicator interface that identifies geometries that can have persistent Z values attached to their vertices.
IZCollection Provides access to operations on Z-aware geometries.
[C#]

 

        private static object _missing = Type.Missing;

 

        public static IGeometry GetPolylineGeometry()

        {

            const double PathCount = 3;
            const double PathVertexCount = 3;

           
IGeometryCollection geometryCollection = new PolylineClass();

 

            for (int i = 0; i < PathCount; i++)

            {

                IPointCollection pointCollection = new PathClass();

 

                for (int j = 0; j < PathVertexCount; j++)

                {

                    pointCollection.AddPoint(GetPoint(), ref _missing, ref _missing);

                }

 

                geometryCollection.AddGeometry(pointCollection as IGeometry, ref _missing, ref _missing);

            }

 

            MakeZAware(geometryCollection as IGeometry);

 

            return geometryCollection as IGeometry;

        }

        private static IPoint GetPoint()

        {

            const double Min = -10;

            const double Max = 10;

 

            Random random = new Random();

 

            double x = Min + (Max - Min) * random.NextDouble();

            double y = Min + (Max - Min) * random.NextDouble();

            double z = Min + (Max - Min) * random.NextDouble();

 

            return ConstructPoint3D(x, y, z);

        }

 

        private static IPoint ConstructPoint3D(double x, double y, double z)

        {

            IPoint point = ConstructPoint2D(x, y);

            point.Z = z;

           
return point;

        }


        private static IPoint ConstructPoint2D(double x, double y)

        {

            IPoint point = new PointClass();

            point.PutCoords(x, y);
 

            return point;

        }

        private static void MakeZAware(IGeometry geometry)

        {

            IZAware zAware = geometry as IZAware;

            zAware.ZAware = true;

        }