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


Line CoClass (ArcObjects .NET 10.6 SDK)
ArcObjects Help for .NET developers > ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Classes > L > Line CoClass (ArcObjects .NET 10.6 SDK)
ArcObjects Library Reference (Geometry)  

Line CoClass

A 2D straight line between a pair of 2D endpoints; can optionally have height, measure and ID attributes at each endpoint.

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.
IConstructLine Provides access to members that construct a line segment using other geometries and measures.
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.
ILine Provides access to members that identify a straight line segment and defines its properties.
ILine2 Provides access to the coordinates of a line segment in the form of Well Known Structures (WKS).
ILine3 Provides access to members that identify a straight line segment and defines its properties.
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.
ISegment Provides access to members that identify a segment. A segment is a way of getting between two endpoints.
ISegmentID Provides access to members that allow simple manipulations of IDs at the segment level.
ISegmentM Provides access to members that allow simple manipulations of Ms at the segment level.
ISegmentZ Provides access to members that allow simple manipulations of Zs at the segment level.
ISupportErrorInfo (esriSystem)
ITransform2D Provides access to methods for transforming geometries using either specific parameters or arbitrary transformation objects (affine transformations, geographic transformations, etc.).
[C#]

 

 

        public static IGeometry GetLineGeometry()

        {

               ILine line = new LineClass()

               line.FromPoint=GetPoint();
               line.ToPoint=GetPoint(); 

 

               return line 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;

        }