This document is archived and information here might be outdated. Recommended version. |
ArcObjects Help for .NET developers > ArcObjects namespaces > Editor > ESRI.ArcGIS.Editor > Interfaces > IC > ICourse Interface (ArcObjects .NET 10.5 SDK) |
Provides access to members that define a course in a traverse.
Description | ||
---|---|---|
AddSegment | Adds a reference for the course to the input geometry. | |
Clone | Clones the course and adds the result to *clone. | |
CurveDirectionType | If the course type is esriCTCurve, defines the curve direction type of the third value. | |
CurveParameter1 | If the course type is esriCTTangentCurve or esriCTCurve, defines the curve parameter of the first value. | |
CurveParameter2 | If the course type is esriCTTangentCurve or esriCTCurve, defines the curve parameter of the second value. | |
GetDescription | Description of the course. | |
Measure1 | The first value that defines the course. | |
Measure2 | The second value that defines the course. | |
Measure3 | Optionally, the direction of the curve if the course type is esriCTCurve. | |
TurnDirection | Indicates if curve turns to the left or right. | |
Type | The type of course. |
CoClasses and Classes | Description |
---|---|
Course | Creates line segments defined by COGO descriptions. |
ICourse allows Segments to be constructed with coordinate geometry values. The type of segment created depends on the course Type. The DirectionDistance and AngleDistance courses create line segments, the TangentCurve and Curve courses create circular arc segments.
When the course type is DirectionDistance, Measure1 is the direction of the line segment and Measure2 is the distance of the line segment. For a course type of AngleDistance, Measure1 is the clockwise angle between the previous segment and the new segment and Measure2 is the distance of the line segment. For both the TangentCurve and Curve course types, Measure1 and Measure2 are any two of the valid CurveParameters required to create a circular arc including Chord Length, Arc Length, Delta Angle or Radius. The TurnDirection is also required to indicate if the curve turns to the left or right If the course type is Curve, Measure3 and CurveDirection define the direction of the curve.
AddSegment is used to create the new segment once the parameters are set. A from point must exist for the segment to be added relative to. GetDescription can be used to return a description of the course using the current Editor DirectionType and DirectionUnits.
All directions are in polar radians, angles are in radians and distances are in the current map units of the data frame.
/// <summary>
/// This method creates a polyline edit sketch using a series of courses
/// </summary>
private void TraverseCourse()
{
UID editorUID=new UIDClass();
editorUID.Value="esriEditor.Editor";
IEditor editor=m_application.FindExtensionByCLSID(editorUID) as IEditor;
IEditSketch editSketch=editor as IEditSketch;
// Make sure the current target is a polyline
if(editSketch.GeometryType == esriGeometryType.esriGeometryPolyline)
{
// Create a startpoint for the sketch
IPoint startPoint=new PointClass();
startPoint.PutCoords(709500.0, 407600.0);
IGeometry polyline=new PolylineClass() as IGeometry;
IPointCollection pointCollection=polyline as IPointCollection;
pointCollection.AddPoints(1,ref startPoint);
for(int i=0; i<4;i++){
ICourse course=new CourseClass();
switch(i){
case 0: // Direction distance
course.Type=esriCourseType.esriCTDirectionDistance;
course.Measure1=0.7; // Radians
course.Measure2=100;
break;
case 1:
course.Type=esriCourseType.esriCTAngleDistance;
course.Measure1=-1.4; // Radians
course.Measure2=100;
break;
case 2: // Tangent curve
course.Type=esriCourseType.esriCTTangentCurve;
course.Measure1=200;
course.CurveParameter1=esriCurveParameter.esriCPRadius;
course.Measure2=1.5;
course.CurveParameter2=esriCurveParameter.esriCPAngle;
course.TurnDirection=esriTurnDirection.esriTDLeft;
break;
case 3: // Non-tangent curve
course.Type=esriCourseType.esriCTCurve;
course.Measure1=200;
course.CurveParameter1=esriCurveParameter.esriCPArc;
course.Measure2=150;
course.CurveParameter2=esriCurveParameter.esriCPChord;
course.Measure3=4.5;
course.CurveDirectionType=esriCurveDirectionType.esriCDTRadial;
course.TurnDirection=esriTurnDirection.esriTDRight;
break;
}
// Write out a description of the course
System.Windows.Forms.MessageBox.Show("Course description: " + course.GetDescription(editor));
course.AddSegment(polyline, 1, 0);
}
// Add the geometry to the edit sketch
ISketchOperation sketchOperation=new SketchOperationClass();
sketchOperation.Start(editor);
editSketch.Geometry=polyline;
editSketch.ModifySketch();
sketchOperation.Finish(polyline.Envelope);
}
}