This document is archived and information here might be outdated. Recommended version. |
ArcObjects namespaces > Geometry > ESRI.ArcGIS.Geometry > Interfaces > IC > ICurve2 Interface > ICurve2.PutCoordsEx Method (ArcObjects .NET 10.4 SDK) |
Sets this segment's endpoints to 'from' and 'to'.
[Visual Basic .NET] Public Sub PutCoordsEx ( _ ByVal from As IPoint, _ ByVal to As IPoint _ )
[C#] public void PutCoordsEx ( IPoint from, IPoint to );
[C++]
HRESULT PutCoordsEx(
IPoint* from,
IPoint* to
);
PutCoordsEx allows both the fromPoint and the toPoint to be set simultaneously.
A Conformal Transformation based on the original points and the new points
is applied to the curve.
//This example demonstrates how to use the PutCoordsEx method
static void PutCoordsEx_Example()
{
//Create a new CircularArc
IPoint fromPoint=new PointClass();
fromPoint.PutCoords(0, 0);
IPoint centerPoint=new PointClass();
centerPoint.PutCoords(5, 0);
IPoint toPoint=new PointClass();
toPoint.PutCoords(10, 0);
ICircularArc circularArc=new CircularArcClass();
circularArc.PutCoords(centerPoint, fromPoint, toPoint, esriArcOrientation.esriArcClockwise);
ICurve2 curve=circularArc as ICurve2;
//Create new points
IPoint newFromPoint=new PointClass();
newFromPoint.PutCoords(-5, 0);
IPoint newToPoint=new PointClass();
newToPoint.PutCoords(15, 10);
//Use the new points to modify the end points
//of the CircularArc. The method will perform a conformal
//transformation on the curves to adjust the end points
String report="Curves before PutCoordsEx \n";
report=report + printCircularArcProperties(curve as ICircularArc);
curve.PutCoordsEx(newFromPoint, newToPoint);
report=report + "Curves after PutCoordsEx \n";
report=report + printCircularArcProperties(curve as ICircularArc);
System.Windows.Forms.MessageBox.Show(report);
}
static String printCircularArcProperties(ICircularArc circularArc)
{
String report="Radius : " + circularArc.Radius + "\n" +
"Chord Height : " + circularArc.ChordHeight + "\n" +
"Central Angle (Rad) : " + circularArc.CentralAngle + "\n" +
"From Angle (Rad) : " + circularArc.FromAngle + "\n" +
"To Angle (Rad) : " + circularArc.ToAngle + "\n" +
"Center Point : " + circularArc.CenterPoint.X + " , " + circularArc.CenterPoint.Y;
return report;
}
'This example demonstrates how to use the PutCoordsEx method
Sub PutCoordsEx_Example()
Dim pCarc As ICircularArc, pCurve As ICurve2
Dim ptc As IPoint, pfr As IPoint, pto As IPoint
Dim pNewFr As IPoint, pNewTo As IPoint
'Create a new CircularArc
pCarc=New CircularArc
ptc=New Point
ptc.PutCoords(5, 0)
pfr=New Point
pfr.PutCoords(0, 0)
pto=New Point
pto.PutCoords(10, 0)
pCarc.PutCoords(ptc, pfr, pto, esriArcOrientation.esriArcClockwise)
pCurve=pCarc 'QI
'Create new points
pNewFr=New Point
pNewFr.PutCoords(-5, 0)
pNewTo=New Point
pNewTo.PutCoords(15, 10)
'Use the new points to modify the end points
'of the CircularArc. The method will perform a conformal
'transformation on the curves to adjust the end points
Debug.Print("*** Curves before PutCoordsEx ***")
printCArcProp(pCurve)
pCurve.PutCoordsEx(pNewFr, pNewTo)
Debug.Print("*** Curves after PutCoordsEx ***")
printCArcProp(pCurve)
End Sub
Sub printCArcProp(ByVal pCarc As ICircularArc)
Debug.Print("Radius : " & pCarc.Radius)
Debug.Print("Chord Height : " & pCarc.ChordHeight)
Debug.Print("Central Angle (Rad) : " & pCarc.CentralAngle)
Debug.Print("From Angle (Rad) : " & pCarc.FromAngle)
Debug.Print("To Angle (Rad) : " & pCarc.ToAngle)
Debug.Print("Center Point : " & pCarc.CenterPoint.X & " , " & pCarc.CenterPoint.Y)
End Sub