Constructs a point distance units from start, parallel to the tangent at the point nearest to start on the (extended) segment.
[Visual Basic .NET] Public Sub ConstructParallel ( _ ByVal Segment As ISegment, _ ByVal extension As esriSegmentExtension, _ ByVal start As IPoint, _ ByVal distance As Double _ )
[C#] public void ConstructParallel ( ISegment Segment, esriSegmentExtension extension, IPoint start, double distance );
[C++]
HRESULT ConstructParallel(
ISegment* Segment,
esriSegmentExtension extension,
IPoint* start,
double distance
);
[C++]Parameters
SegmentSegment is a parameter of type ISegment
extensionextension is a parameter of type esriSegmentExtension
startstart is a parameter of type IPoint
distance distance is a parameter of type double
Product Availability
Description
ConstructParallel constructs a Point a specified distance from the input point in the direction parallel to the tangent of the nearest point on the extended input segment.
Remarks
//The example shows how to construct a point parallel to the first segment
//of a selected polyline. Use ArcMap and the Object Editor to select the
//polyline.
public void ConstructPointParallelToLine(IMxDocument mxDocument)
{
IMap map = mxDocument.FocusMap;
IEnumFeature selectedFeatures = map.FeatureSelection as IEnumFeature;
selectedFeatures.Reset();
IFeature currentFeature = selectedFeatures.Next();
IConstructPoint constructionPoint = new PointClass();
while (currentFeature != null)
{
if (currentFeature.Shape.GeometryType == esriGeometryType.esriGeometryPolyline)
{
IGeometryCollection geometryCollection = currentFeature.Shape as IGeometryCollection;
ISegmentCollection segmentCollection = geometryCollection.get_Geometry(0) as ISegmentCollection;
ISegment segment = segmentCollection.get_Segment(0);
IPoint fromPoint = new PointClass();
segment.QueryFromPoint(fromPoint);
//add 10 to the x coordinate in order to get a diffrent point for this example
fromPoint.X = fromPoint.X + 10;
constructionPoint.ConstructParallel(segment, esriSegmentExtension.esriNoExtension, fromPoint, segment.Length / 2);
IPoint outPutPoint = constructionPoint as IPoint;
System.Windows.Forms.MessageBox.Show("Output point : " + outPutPoint.X + " , " + outPutPoint.Y);
}
currentFeature = selectedFeatures.Next();
}
}
' The example shows how to construct a point parallel to the first segment
' of a selected polyline. Use ArcMap and the Object Editor to select the
' polyline.
Public Sub t_constructParallel(ByVal pApp As ESRI.ArcGIS.Framework.IApplication)
Dim pID As New ESRI.ArcGIS.esriSystem.UID
pID = "esriEditor.editor"
Dim pEditor As ESRI.ArcGIS.Editor.IEditor
pEditor = pApp.FindExtensionByCLSID(pID)
If pEditor.SelectionCount > 1 Then
MsgBox("select one polyline")
Exit Sub
End If
Dim pEnumFeat As ESRI.ArcGIS.Geodatabase.IEnumFeature
Dim pFeature As ESRI.ArcGIS.Geodatabase.IFeature
Dim i As Long
pEnumFeat = pEditor.EditSelection
Dim pSeg As ESRI.ArcGIS.Geometry.ISegment
Dim pGeoColl As ESRI.ArcGIS.Geometry.IGeometryCollection
Dim pPoint As ESRI.ArcGIS.Geometry.IPoint
pPoint = New ESRI.ArcGIS.Geometry.Point
Dim pCPoint As ESRI.ArcGIS.Geometry.IConstructPoint
pCPoint = New ESRI.ArcGIS.Geometry.Point
Dim pThroughPoint As ESRI.ArcGIS.Geometry.IPoint
pThroughPoint = New ESRI.ArcGIS.Geometry.Point
pFeature = pEnumFeat.Next
While Not pFeature Is Nothing
If pFeature.Shape.GeometryType = ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPolyline Then
pGeoColl = pFeature.Shape
Dim pSegColl As ESRI.ArcGIS.Geometry.ISegmentCollection
pSegColl = pGeoColl.Geometry(0)
pSeg = pSegColl.Segment(0)
pSeg.QueryFromPoint(pThroughPoint)
pThroughPoint.X = pThroughPoint.X + 10
pCPoint.ConstructParallel(pSeg, ESRI.ArcGIS.Geometry.esriSegmentExtension.esriNoExtension, pThroughPoint, pSeg.Length / 2)
pPoint = pCPoint
MsgBox(pPoint.X & "," & pPoint.Y)
End If
pFeature = pEnumFeat.Next
End While
End Sub