Provides access to members that interact with the Traverse Window dialog. Note: the ITraverseWindow interface has been superseded byITraverseWindow2. Please consider using the more recent version.
Product Availability
Members
Description | ||
---|---|---|
Add | Add the course that is defined by the current course parameters. | |
Course | A reference to the ith course. | |
CourseCount | The number of courses in the traverse. | |
CourseType | The type of the course being added. | |
CurveDirectionType | If the course type is esriCTCurve, defines the direction type of the curve. | |
CurveParameter | If the course type is esriCTCurve or esriCTTangentCurve, describes the type of curve paramater that the ith measure text represents. | |
FinishPoint | The specified end point of the traverse. | |
IsAddEnabled | Indicates if the Add command on the Traverse Window dialog is enabled. | |
MeasureHWND | The handle of the ith measure text control. | |
MeasureSelected | Indicates if the text in the ith measure is selected. | |
MeasureText | The ith value that defines the course to add. | |
SetFocusToMeasure | Change the focus to the ith measure text control. | |
StartPoint | The specified start point of the traverse. | |
TurnDirection | If the course type is esriCTCurve or esriCTTangentCurve, indicates if the curve turns to the left or right. | |
Visible | Indicates if Traverse Window is visible. |
CoClasses that implement ITraverseWindow
CoClasses and Classes | Description |
---|---|
TraverseWindow | Dialog for creating traverses. |
Remarks
ITraverseWindow allows courses to be added to the existing traverse within the Traverse dialog. A current workspace must be being edited for the Traverse dialog to be enabled. Also the current edit layer must be either a Polyline or a Polygon.
The type of course being added to the traverse depends on the CourseType. The esriCTDirectionDistance and esriCTAngleDistance courses create line segments, the esriCTCurve and esriCTTangentCurve courses create circular arc segments. The courses are defined by text values within the MeasureText, CurveParameter, CurveDirectionType and TurnDirection properties.
When the course type is DirectionDistance, MeasureText(0) is the direction of the course and MeasureText(1) is the distance of the course. For a course type of AngleDistance, MeasureText(0) is the clockwise angle between the previous segment and the new segment and MeasureText(1) is the distance of the line segment. For both the TangentCurve and Curve course types, MeasureText(0) is a text value representing the appropriate curve parameter defined by CurveParameter(0) and MeasureText(1) is a text value representing the appropriate curve parameter defined by CurveParameter(1). Any two of the CurveParameters are 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, a text value in MeasureText(2) and CurveDirectionType define the direction of the curve.
Once all of the parameters have been set for a course, IsAddEnabled will test if the values are correct. Add is used to create a new course. The StartPoint needs to be set before any courses can be added. An optional FinishPoint can exist for the traverse.
All Directions and Angles are in the current units specified within the Editor options. Distances are in the current data frame map units, however they can also be entered with an appropriate suffix that specifies the length units. Refer to the IDistanceConverter for more on the converting distances.
To interact with specific controls on the Traverse Window dialog, the MeasureSelected, MeasureHWND and SetFocusToMeasure methods are used.
The following code adds various courses to the Traverse Window dialog.
public void AddCoursesToTraverseWindow()
{
//You can get app from ICommand :: OnCreate() hook parameter
UID editorUid = new UIDClass();
editorUid.Value = "esriEditor.Editor";
IEditor editor = app.FindExtensionByCLSID(editorUid) as IEditor;
//Get a reference to the traverse window
UID extUid = new UIDClass();
extUid.Value = "esriEditor.TraverseWindow";
ITraverseWindow traverseWindow = editor.FindExtension(extUid) as ITraverseWindow;
//Make the TraverseWindow visible
if (!traverseWindow.Visible)
traverseWindow.Visible = true;
//Make sure the start point exists
if (traverseWindow.StartPoint == null)
{
System.Windows.Forms.MessageBox.Show("Need to add a start point.");
return;
}
//Change the editor properties to quadrant bearing
IEditProperties2 editProp = editor as IEditProperties2;
editProp.DirectionType = esriDirectionType.esriDTQuadrantBearing;
editProp.DirectionUnits = esriDirectionUnits.esriDUDegreesMinutesSeconds;
editProp.AngularUnitPrecision = 0;
//Add a DirectionDistance course
traverseWindow.CourseType = esriCourseType.esriCTDirectionDistance;
traverseWindow.set_MeasureText(0, "N23-55-10E");
traverseWindow.set_MeasureText(1, "25.87");
if (traverseWindow.IsAddEnabled == true)
traverseWindow.Add();
//Add an AngleDistance course
traverseWindow.CourseType = esriCourseType.esriCTAngleDistance;
traverseWindow.set_MeasureText(0, "75-20");
traverseWindow.set_MeasureText(1, "30.7");
if (traverseWindow.IsAddEnabled == true)
traverseWindow.Add();
//Add a TangentCurve course
traverseWindow.CourseType = esriCourseType.esriCTTangentCurve;
//First curve parameter is an arc length
traverseWindow.set_CurveParameter(0, esriCurveParameter.esriCPArc);
traverseWindow.set_MeasureText(0, "39.0");
//Second curve parameter is a radius
traverseWindow.set_CurveParameter(1, esriCurveParameter.esriCPRadius);
traverseWindow.set_MeasureText(1, "50");
//The curve turns to the left
traverseWindow.TurnDirection = esriTurnDirection.esriTDLeft;
if (traverseWindow.IsAddEnabled == true)
traverseWindow.Add();
//Add a Curve course
traverseWindow.CourseType = esriCourseType.esriCTCurve;
//First curve parameter is a delta angle
traverseWindow.set_CurveParameter(0, esriCurveParameter.esriCPAngle);
traverseWindow.set_MeasureText(0, "45-30");
// Second curve parameter is a chord length
traverseWindow.set_CurveParameter(1, esriCurveParameter.esriCPChord);
traverseWindow.set_MeasureText(1, "29.3");
//Set the direction of the curve to be the radial direction
traverseWindow.CurveDirectionType = esriCurveDirectionType.esriCDTRadial;
traverseWindow.set_MeasureText(2, "S60-44W");
//The curve turns to the right
traverseWindow.TurnDirection = esriTurnDirection.esriTDRight;
if (traverseWindow.IsAddEnabled == true)
traverseWindow.Add();
// Report the courses that have just been added
if (traverseWindow.CourseCount > 0)
{
string courses = "";
for (int count = 0; count < traverseWindow.CourseCount; count++)
courses += traverseWindow.get_Course(count).GetDescription(editor) + "\n";
System.Windows.Forms.MessageBox.Show(traverseWindow.CourseCount + " Courses " + "\n" + courses);
}
}
The following code adds various courses to the Traverse Window dialog.
Public Sub AddCoursesToTraverseWindow() 'You can get app from ICommand :: OnCreate() hook parameter Dim editorUid As UID = New UIDClass() editorUid.Value = "esriEditor.Editor" Dim editor As IEditor = TryCast(app.FindExtensionByCLSID(editorUid), IEditor) 'Get a reference to the traverse window Dim extUid As UID = New UIDClass() extUid.Value = "esriEditor.TraverseWindow" Dim traverseWindow As ITraverseWindow = TryCast(editor.FindExtension(extUid), ITraverseWindow) 'Make the TraverseWindow visible If Not traverseWindow.Visible Then traverseWindow.Visible = True End If 'Make sure the start point exists If traverseWindow.StartPoint Is Nothing Then System.Windows.Forms.MessageBox.Show("Need to add a start point.") Return End If 'Change the editor properties to quadrant bearing Dim editProp As IEditProperties2 = TryCast(editor, IEditProperties2) editProp.DirectionType = esriDirectionType.esriDTQuadrantBearing editProp.DirectionUnits = esriDirectionUnits.esriDUDegreesMinutesSeconds editProp.AngularUnitPrecision = 0 'Add a DirectionDistance course traverseWindow.CourseType = esriCourseType.esriCTDirectionDistance traverseWindow.MeasureText(0) = "N23-55-10E" traverseWindow.MeasureText(1) = "25.87" If traverseWindow.IsAddEnabled = True Then traverseWindow.Add() End If 'Add an AngleDistance course traverseWindow.CourseType = esriCourseType.esriCTAngleDistance traverseWindow.MeasureText(0) = "75-20" traverseWindow.MeasureText(1) = "30.7" If traverseWindow.IsAddEnabled = True Then traverseWindow.Add() End If 'Add a TangentCurve course traverseWindow.CourseType = esriCourseType.esriCTTangentCurve 'First curve parameter is an arc length traverseWindow.CurveParameter(0) = esriCurveParameter.esriCPArc traverseWindow.MeasureText(0) = "39.0" 'Second curve parameter is a radius traverseWindow.CurveParameter(1) = esriCurveParameter.esriCPRadius traverseWindow.MeasureText(1) = "50" 'The curve turns to the left traverseWindow.TurnDirection = esriTurnDirection.esriTDLeft If traverseWindow.IsAddEnabled = True Then traverseWindow.Add() End If 'Add a Curve course traverseWindow.CourseType = esriCourseType.esriCTCurve 'First curve parameter is a delta angle traverseWindow.CurveParameter(0) = esriCurveParameter.esriCPAngle traverseWindow.MeasureText(0) = "45-30" ' Second curve parameter is a chord length traverseWindow.CurveParameter(1) = esriCurveParameter.esriCPChord traverseWindow.MeasureText(1) = "29.3" 'Set the direction of the curve to be the radial direction traverseWindow.CurveDirectionType = esriCurveDirectionType.esriCDTRadial traverseWindow.MeasureText(2) = "S60-44W" 'The curve turns to the right traverseWindow.TurnDirection = esriTurnDirection.esriTDRight If traverseWindow.IsAddEnabled = True Then traverseWindow.Add() End If ' Report the courses that have just been added If traverseWindow.CourseCount > 0 Then Dim courses As String = "" Dim count As Integer For count = 0 To traverseWindow.CourseCount - 1 Step count + 1 courses += traverseWindow.Course(count).GetDescription(editor) + "\n" Next System.Windows.Forms.MessageBox.Show(traverseWindow.CourseCount + " Courses " + "\n" + courses) End If End Sub