ArcObjects Library Reference (Geometry)  

ICurve.QueryFromPoint Method

Copies this curve's 'from' point to the input point.

[Visual Basic .NET]
Public Sub QueryFromPoint ( _
    ByVal from As IPoint _
)
[C#]
public void QueryFromPoint (
    IPoint from
);
[C++]
HRESULT QueryFromPoint(
  IPoint* from
);
[C++]

Parameters

from

  from is a parameter of type IPoint

Product Availability

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

Description

Used to query the FromPoint of the first Segment of the first part of the curve.

Remarks

Note: The output geometry must be co-created prior to the query. The output geometry is not co-created by the method; it is populated. This can be used in performance critical situations. For example, creating the geometry only once outside a loop and use the query method could improve performance.

QueryFromPoint Example

[C#]

//The example shows how to query the from and to points of a curve.
public void ICurveQueryPoints(IFeature currentFeature)
{
    if (currentFeature.Shape.GeometryType == esriGeometryType.esriGeometryPolyline ||
        currentFeature.Shape.GeometryType == esriGeometryType.esriGeometryLine)
    {
        ICurve curve = currentFeature.Shape as ICurve;
        IPoint fromPoint = new PointClass();
        IPoint toPoint = new PointClass();
        curve.QueryFromPoint(fromPoint);
        curve.QueryToPoint(toPoint);
        System.Windows.Forms.MessageBox.Show("ICurve properties..." + "\n" +
                        "Curve.QueryFromPoint (x,y) = " + fromPoint.X + "," + fromPoint.Y + "\n" +
                        "Curve.QueryToPoint (x,y) = " + toPoint.X + "," + toPoint.Y);
    }
}

[Visual Basic .NET]

    ' The example shows how to query the from and to points of a curve.
    Public Sub t_ICurve_QueryPoints(ByVal pFeature As IFeature)
        Dim pCurve As ICurve
        Dim pPointFrom As IPoint
        Dim pPointTo As IPoint
        pPointFrom = New Point
        pPointTo = New Point

        If pFeature.Shape.GeometryType = esriGeometryType.esriGeometryPolyline Or _
            esriGeometryType.esriGeometryPolyline Or esriGeometryType.esriGeometryLine Then
            pCurve = pFeature.Shape
            pCurve.QueryFromPoint(pPointFrom)
            pCurve.QueryToPoint(pPointTo)
            MsgBox("+++ICurve properties..." & vbCrLf _
              & "Curve.QueryFromPoint (x,y) = " & pPointFrom.X & "," & pPointFrom.Y & vbCrLf _
              & "Curve.QueryToPoint (x,y) = " & pPointTo.X & "," & pPointTo.Y & vbCrLf)
        End If
    End Sub

See Also

ICurve Interface | IPoint Interface | ICurve.QueryFromPoint Method | ICurve.FromPoint Property | ICurve.QueryToPoint Method | ICurve.ToPoint Property

.NET Related Topics

How to work with ICurve methods |