Provides access to members that construct a point using other geometries and measures.
Members
Name | Description | |
---|---|---|
ConstructAlong | Constructs a point distance units along the input curve. | |
ConstructAngleBisector | Constructs a point on the bisector of the angle (from, through, to). When useAcuteAngle is false, the sign of distance will select a point right or left of (from, through, to). Otherwise, the sign of distance will select the acute/obtuse point. | |
ConstructAngleDistance | Constructs a point at a specified angle (in radians) from the horizontal axis and a specified distance away from the input point. | |
ConstructAngleIntersection | Constructs the point of intersection between two lines defined by the input points and angles (in radians). | |
ConstructDeflection | Constructs a point in the polar coordinate system defined by baseLine and its 'from' point. The angle is in radians. | |
ConstructDeflectionIntersection | Constructs the point of intersection of two rays with origins at the endpoints of the base line and the specified angles (in radians). If onRightSide is true, this work will be done to the right of the base line, otherwise to the left. | |
ConstructOffset | Constructs a point distance units along the input curve and offset units perpendicularly away from it. | |
ConstructParallel | Constructs a point distance units from start, parallel to the tangent at the point nearest to start on the (extended) segment. | |
ConstructPerpendicular | Constructs a point 'distance' units from p and lying along the line normal to base and passing through p. | |
ConstructThreePointResection | Constructs the point of observation from which two signed angles between three points were measured; returns an angle which can help establish the confidence of the observation location: A small angle indicates greater uncertainty in the location. |
IConstructPoint.ConstructAlong Method
Constructs a point distance units along the input curve.
Public Sub ConstructAlong ( _
ByVal curve As ICurve, _
ByVal extension As esriSegmentExtension, _
ByVal distance As Double, _
ByVal asRatio As Boolean _
)
public void ConstructAlong (
ICurve curve,
esriSegmentExtension extension,
double distance,
bool asRatio
);
Remarks
If the Distance parameter is less than zero, or greater than the length of the curve (when asRatio is false), or greater than one (when asRatio is true), then the value of the Extension parameter is used to determine the coordinates of the constructed point. In these cases, the point can be placed somewhere along an embedding geometry, or somewhere along a tangent geometry.
The embedding geometry of a straight line segment is a straight line extending infinitely in both directions. The embedding geometry of a circular arc is a complete circle. The embedding geometry of an elliptic arc is a complete ellipse. A bezier curve has no embedding geometry.
A tangent geometry is always a ray (a straight line extending infinitely in one direction) tangent to the input curve at either its from (start) or to (end) points.
Possible values for the Extension parameter are: -------------------------------------------------esriNoExtension The constructed point will always be on the input curve. A distance < 0 will pin the constructed point to the location of the input curve's from point. A distance > the curve length (or > 1 when asRatio is true) will pin the location to the curve's to point.
esriExtendTangentAtFrom If the distance parameter is < 0 then the point is constructed along a ray tangent to the start point of the curve, in a direction away from the curve.
esriExtendTangentAtTo If the distance parameter is greater than the length of the input curve (or > 1 when asRatio is true), then the constructed point is placed along a ray tangent to the end point of the curve, in a direction away from the curve.
esriExtendEmbeddedAtFrom Similar to the tangent option, but uses the embedding geometry instead of the tangent lines.
esriExtendEmbeddedAtTo Similar to the tangent option, but uses the embedding geometry instead of the tangent lines.
esriExtendEmbedded The point is constructed based on either the start or end points of the curve.
esriExtendTangents The point is tangential extended from the start or endpoint of the curve.
These values can be combined using the VB Or operator, or the C++ bitwise OR operator.
Example 1: esriExtendTangentAtFrom Or esriExtendTangentAtTo
Instead of using esriExtendTangents
you could use esriExtendTangentAtFrom Or esriExtendTangentAtTo.
This would allow the point to be constructed anywhere along infinte straight lines, beginning from either the start or end of the curve, regardless of whether the distance parameter was less than 0, or greater than the length of the input curve (or > 1 when asRatio is true).
//Select a polyline in ArcMap and calculate a point along the line
// at 100 distance units from the start point.
public void ConstructPointAlongLine(IPolyline pl)
{
ICurve polyLine = pl;
IPoint point1 = ConstructPointAlong(100, polyLine, esriSegmentExtension.esriNoExtension, false);
System.Windows.Forms.MessageBox.Show("x,y = " + point1.X + "," + point1.Y);
IPoint point2 = ConstructPointAlong(0.5, polyLine, esriSegmentExtension.esriNoExtension, true);
System.Windows.Forms.MessageBox.Show("x,y = " + point2.X + "," + point2.Y);
}
public IPoint ConstructPointAlong(double distance, ICurve curve, esriSegmentExtension extension, bool asRatio)
{
IConstructPoint contructionPoint = new PointClass();
contructionPoint.ConstructAlong(curve, extension, distance, asRatio);
return contructionPoint as IPoint;
}
'+++ Calculate a point along a polyline
'+++ at 100 distance units from the start point.
Public Sub t_ConstructAlong(ByRef pPolyLine As ESRI.ArcGIS.Geometry.IPolyline)
On Error GoTo Errorhandler
Dim pPoint As ESRI.ArcGIS.Geometry.IPoint
Dim pCrv As ESRI.ArcGIS.Geometry.ICurve
pCrv = pPolyLine
pPoint = PtConstructAlong(100, pCrv, ESRI.ArcGIS.Geometry.esriSegmentExtension.esriNoExtension, False)
MsgBox("x,y = " & pPoint.X & "," & pPoint.Y)
pPoint = PtConstructAlong(0.5, pPolyLine, ESRI.ArcGIS.Geometry.esriSegmentExtension.esriNoExtension, True) ' Midpoint
MsgBox("x,y = " & pPoint.X & "," & pPoint.Y)
Exit Sub
Errorhandler:
MsgBox(Err.Number & "..." & Err.Description)
Exit Sub
End Sub
Public Function PtConstructAlong(ByVal dDist As Double, ByVal pCurve As ESRI.ArcGIS.Geometry.ICurve, ByVal extension As ESRI.ArcGIS.Geometry.esriSegmentExtension, ByVal asRatio As Boolean) As ESRI.ArcGIS.Geometry.IPoint
Dim pCPoint As ESRI.ArcGIS.Geometry.IConstructPoint
pCPoint = New ESRI.ArcGIS.Geometry.Point
pCPoint.ConstructAlong(pCurve, extension, dDist, asRatio)
PtConstructAlong = pCPoint
End Function
IConstructPoint.ConstructAngleBisector Method
Constructs a point on the bisector of the angle (from, through, to). When useAcuteAngle is false, the sign of distance will select a point right or left of (from, through, to). Otherwise, the sign of distance will select the acute/obtuse point.
Public Sub ConstructAngleBisector ( _
ByVal from As IPoint, _
ByVal through As IPoint, _
ByVal to As IPoint, _
ByVal distance As Double, _
ByVal useAcuteAngle As Boolean _
)
public void ConstructAngleBisector (
IPoint from,
IPoint through,
IPoint to,
double distance,
bool useAcuteAngle
);
Description
Constructs a Point at specified Distance along the line which bisects the Angle formed by the right side of the three input points. If the right side angle is smaller, the constructed line along which the Point is constructed will always bisect this angle, regardless of the value of bUseSmallerAngle. However, if the right side angle is larger, and bUseSmallerAngle is TRUE, then the Point will be on the line constructed which bisects the smaller angle (left side) instead of the right side angle.
Remarks
The method uses a vector geometry to calculate the point. The Smaller Angle is the angle less than PI.If From , To and Through points are all on a straight line , the point is calculated perpendicular (to the right) of the line.
private void ConstructAngleBisector()
{
IPoint fromPoint = new PointClass();
fromPoint.PutCoords(0, 0);
IPoint throughPoint = new PointClass();
throughPoint.PutCoords(10, 0);
IPoint toPoint = new PointClass();
toPoint.PutCoords(0, 10);
IConstructPoint constructionPoint = new PointClass();
constructionPoint.ConstructAngleBisector(fromPoint, throughPoint, toPoint, 10, true);
IPoint outPutPoint = constructionPoint as IPoint;
System.Windows.Forms.MessageBox.Show("Output point : " + outPutPoint.X + " , " + outPutPoint.Y);
}
Public Sub ConstructAngleBisector()
Dim ptTr As ESRI.ArcGIS.Geometry.IPoint
Dim ptTo As ESRI.ArcGIS.Geometry.IPoint
Dim ptFrom As ESRI.ArcGIS.Geometry.IPoint
Dim pConstructLine As ESRI.ArcGIS.Geometry.IConstructLine
Dim pOutPutLine As ESRI.ArcGIS.Geometry.ILine
Dim Pi As Double
Pi = 4 * Math.Atan(1)
ptTr = New ESRI.ArcGIS.Geometry.Point
ptTo = New ESRI.ArcGIS.Geometry.Point
ptFrom = New ESRI.ArcGIS.Geometry.Point
pConstructLine = New ESRI.ArcGIS.Geometry.Line
ptTr.PutCoords(0, 0)
ptTo.PutCoords(0, 10)
ptFrom.PutCoords(10, 0)
pConstructLine.ConstructAngleBisector(ptFrom, ptTr, ptTo, 10, True)
pOutPutLine = pConstructLine 'QI
Debug.Print(pOutPutLine.Length)
'Angle from the XAxis
Debug.Print((180 * pOutPutLine.Angle) / Pi)
End Sub
IConstructPoint.ConstructAngleDistance Method
Constructs a point at a specified angle (in radians) from the horizontal axis and a specified distance away from the input point.
Public Sub ConstructAngleDistance ( _
ByVal p As IPoint, _
ByVal inAngle As Double, _
ByVal distance As Double _
)
public void ConstructAngleDistance (
IPoint p,
double inAngle,
double distance
);
Description
The ConstructAngleDistance method, given a point (p), construct another point at an angle (inangle) and a distance(distance).
Remarks
Angle in radians and distancein map units. The angle is measured counter-clockwise from the horizontal line and can be negative. If the distance is negative then the opposite direction is assumed (same as angle + PI).
// select a point in ArcMap and calculate a new point with the
// angle of 45 degrees and distance on 250 map units.
public void ConstructAngleDistance()
{
IMxDocument mxDocument = m_application.Document as IMxDocument;
IMap map = mxDocument.FocusMap;
ISelection featureSelection = map.FeatureSelection;
IEnumFeature featureEnumerator = featureSelection as IEnumFeature;
featureEnumerator.Reset();
IFeature currentFeature = featureEnumerator.Next();
double distance = 250;
double angle = 45;
while (currentFeature != null)
{
if (currentFeature.Shape.GeometryType == esriGeometryType.esriGeometryPoint)
{
IPoint startPoint = currentFeature.Shape as IPoint;
System.Windows.Forms.MessageBox.Show("Start Point: " + startPoint.X + ", " + startPoint.Y + "\n" +
"Angle: " + angle + "\n" + "Distance: " + distance);
IPoint point = _ConstructAngleDistance(startPoint, angle, distance);
System.Windows.Forms.MessageBox.Show("x,y = " + point.X + "," + point.Y);
}
currentFeature = featureEnumerator.Next();
}
}
private IPoint _ConstructAngleDistance(IPoint point, double angle, double distance)
{
//Convert the angle degrees to radians
double angleRad = angle * 2 * Math.PI / 360;
IConstructPoint construcionPoint = new PointClass();
construcionPoint.ConstructAngleDistance(point, angleRad, distance);
return construcionPoint as IPoint;
}
'+++ select a point in ArcMap and calculate a new point with the
'+++ angle of 45 degrees and distance on 100 map units.
Public Sub t_ConstructAngleDistance(ByRef pMXDoc As ESRI.ArcGIS.ArcMapUI.IMxDocument)
On Error GoTo Errorhandler
Dim pEnumFeat As ESRI.ArcGIS.Geodatabase.IEnumFeature
Dim pFeature As ESRI.ArcGIS.Geodatabase.IFeature
Dim pSelection As ESRI.ArcGIS.Carto.ISelection
Dim pMap As ESRI.ArcGIS.Carto.IMap
Dim pPoint As ESRI.ArcGIS.Geometry.IPoint
Dim pStart As ESRI.ArcGIS.Geometry.IPoint
Dim dDist As Long
Dim dAngle As Long
pMap = pMXDoc.FocusMap
pSelection = pMap.FeatureSelection
pEnumFeat = pSelection
pEnumFeat.Reset()
pFeature = pEnumFeat.Next
dDist = 250
dAngle = 45
While Not pFeature Is Nothing
If pFeature.Shape.GeometryType = ESRI.ArcGIS.Geometry.esriGeometryType.esriGeometryPoint Then
pStart = pFeature.Shape
Debug.Print(1, "Start Point:" & pStart.X & "," & pStart.Y & vbCrLf & _
"Angle:" & dAngle & vbCrLf & "Distance:" & dDist)
pPoint = PtConstructAngleDistance(pStart, dAngle, dDist)
Debug.Print(1, "x,y = " & pPoint.X & "," & pPoint.Y & vbCrLf)
End If
pFeature = pEnumFeat.Next
End While
Exit Sub
Errorhandler:
MsgBox(Err.Number & "..." & Err.Description)
Exit Sub
End Sub
Public Function PtConstructAngleDistance(ByVal pPoint As ESRI.ArcGIS.Geometry.IPoint, ByVal dAngle As Long, ByVal dDist As Long) As ESRI.ArcGIS.Geometry.IPoint
Const PI = 3.14159265358979
Dim dAngleRad As Double
Dim pCPoint As ESRI.ArcGIS.Geometry.IConstructPoint
pCPoint = New ESRI.ArcGIS.Geometry.Point
dAngleRad = dAngle * 2 * PI / 360 'Convert the angle degrees to radians
pCPoint.ConstructAngleDistance(pPoint, dAngleRad, dDist)
PtConstructAngleDistance = pCPoint
End Function
IConstructPoint.ConstructAngleIntersection Method
Constructs the point of intersection between two lines defined by the input points and angles (in radians).
Public Sub ConstructAngleIntersection ( _
ByVal p1 As IPoint, _
ByVal angle1 As Double, _
ByVal p2 As IPoint, _
ByVal angle2 As Double _
)
public void ConstructAngleIntersection (
IPoint p1,
double angle1,
IPoint p2,
double angle2
);
Remarks
Angles are specified as geometric angles measured counterclockwise from the positive x axis of the Cartesian coordinate system. All angles are specified in radians .
//This method constructs a new point as intersection of 2 lines
public void ConstructAngleIntersection()
{
IPoint fromPoint = new PointClass();
fromPoint.PutCoords(0, 0);
IPoint toPoint = new PointClass();
toPoint.PutCoords(100, 0);
double angle1Rad = 45 * 2 * Math.PI / 360;
double angle2Rad = 135 * 2 * Math.PI / 360;
IConstructPoint constructionPoint = new PointClass();
constructionPoint.ConstructAngleIntersection(fromPoint, angle1Rad, toPoint, angle2Rad);
IPoint outPutPoint = constructionPoint as IPoint;
System.Windows.Forms.MessageBox.Show("Output point : " + outPutPoint.X + " , " + outPutPoint.Y);
}
'+++ Construct a new point as intersection of 2 lines
Public Sub t_ConstructAngleIntersection()
On Error GoTo Errorhandler
Dim pPoint1 As ESRI.ArcGIS.Geometry.IPoint
Dim pPoint2 As ESRI.ArcGIS.Geometry.IPoint
Dim pPoint As ESRI.ArcGIS.Geometry.IPoint
Dim dAngle1 As Long
Dim dAngle2 As Long
pPoint1 = New ESRI.ArcGIS.Geometry.Point
pPoint2 = New ESRI.ArcGIS.Geometry.Point
pPoint1.PutCoords(0, 0)
pPoint2.PutCoords(100, 0)
dAngle1 = 45
dAngle2 = 135
pPoint = ptConstructAngleIntersection(pPoint1, dAngle1, pPoint2, dAngle2)
MsgBox("x,y = " & pPoint.X & "," & pPoint.Y)
Exit Sub
Errorhandler:
MsgBox(Err.Number & "..." & Err.Description)
Exit Sub
End Sub
Public Function ptConstructAngleIntersection(ByVal pPt1 As ESRI.ArcGIS.Geometry.IPoint, ByVal dAngle1 As Long, ByVal pPt2 As ESRI.ArcGIS.Geometry.IPoint, ByVal dAngle2 As Long) As ESRI.ArcGIS.Geometry.IPoint
Const PI As Double = 3.14159265358979
Dim dAngleRad1 As Double
Dim dAngleRad2 As Double
Dim pCPoint As ESRI.ArcGIS.Geometry.IConstructPoint
pCPoint = New ESRI.ArcGIS.Geometry.Point
dAngleRad1 = dAngle1 * 2 * PI / 360 ' Conversion degrees to radians
dAngleRad2 = dAngle2 * 2 * PI / 360
pCPoint.ConstructAngleIntersection(pPt1, dAngleRad1, pPt2, dAngleRad2)
ptConstructAngleIntersection = pCPoint
End Function
IConstructPoint.ConstructDeflection Method
Constructs a point in the polar coordinate system defined by baseLine and its 'from' point. The angle is in radians.
Public Sub ConstructDeflection ( _
ByVal baseLine As ILine, _
ByVal distance As Double, _
ByVal inAngle As Double _
)
public void ConstructDeflection (
ILine baseLine,
double distance,
double inAngle
);
Description
The ConstructDeflection method, given a line (baseline), creates a new point at a distance (distance) and at an angle (inAngle).
Remarks
The point is constructed from the baseline start point using the deflection angle (the angle from the baseline to the point) and the distance. The deflection angle is given in radians the distance in map units. When distance is > 0, a positive value for angle rotates the constructed point counter-clockwise about the start point of baseline, and a negative value for angle rotates it the other way. Vice versa when distance is < 0.
//Constructs a point from the baseline from (0,0) to (1,1)
// with the deflection angle of 45 degrees (PI/4 radians).
public void ConstructDeflection()
{
IPoint fromPoint = new PointClass();
fromPoint.PutCoords(0, 0);
IPoint toPoint = new PointClass();
toPoint.PutCoords(1, 1);
ILine line = new LineClass();
line.PutCoords(fromPoint, toPoint);
double distance = 1.4142135623731;
double angle = Math.PI / 4;
IConstructPoint constructionPoint = new PointClass();
constructionPoint.ConstructDeflection(line, distance, angle);
IPoint point = constructionPoint as IPoint;
System.Windows.Forms.MessageBox.Show("x,y = " + point.X + ", " + point.Y);
}
'+++ Constructs a point from the baseline from (0,0) to (1,1)
'+++ with the deflection angle of 45 degrees (PI/4 radians).
Public Sub t_ConstructDeflection()
On Error GoTo Errorhandler
Dim pPointFrom As IPoint
Dim pPointTo As IPoint
Dim pLine As ILine
Dim pPoint As IPoint
Dim pCPoint As IConstructPoint
Dim dDist As Double
Dim dAngle As Double
Dim pi As Double
pPointFrom = New Point
pPointTo = New Point
pCPoint = New Point
pPoint = New Point
pLine = New Line
pPointFrom.PutCoords(0, 0)
pPointTo.PutCoords(1, 1)
pLine.PutCoords(pPointFrom, pPointTo)
dDist = 1.4142135623731
pi = 4 * Math.Atan(1)
dAngle = pi / 4
pCPoint.ConstructDeflection(pLine, dDist, dAngle)
pPoint = pCPoint
MsgBox("x,y = " & pPoint.X & "," & pPoint.Y)
Exit Sub
Errorhandler:
MsgBox(Err.Number & "..." & Err.Description)
Exit Sub
End Sub
IConstructPoint.ConstructDeflectionIntersection Method
Constructs the point of intersection of two rays with origins at the endpoints of the base line and the specified angles (in radians). If onRightSide is true, this work will be done to the right of the base line, otherwise to the left.
Public Sub ConstructDeflectionIntersection ( _
ByVal baseLine As ILine, _
ByVal startAngle As Double, _
ByVal endAngle As Double, _
ByVal OnRightSide As Boolean _
)
public void ConstructDeflectionIntersection (
ILine baseLine,
double startAngle,
double endAngle,
bool OnRightSide
);
Remarks
the bRightSide flag can be used to always force the constructed point to be on the right side of the baseline.The startAngle is the angle (in radians) from the baseline's startpoint of the line to the constructed point. The endAngle is the angle (in radians) from the baseline's endpoint to the constructed point.Both angles have to be > 0 and < 2 PI radians. Their sum must also be less than PI radians.
//Constructs a point from the baseline from (0,0) to (1,1)
//with the deflection angle of 45 degrees (PI/4 radians).
public void ConstructDeflectionIntersection()
{
IPoint fromPoint = new PointClass();
fromPoint.PutCoords(0, 0);
IPoint toPoint = new PointClass();
toPoint.PutCoords(1, 1);
ILine line = new LineClass();
line.PutCoords(fromPoint, toPoint);
double startAngle = Math.PI / 4;
double endAngle = Math.PI / 4;
IConstructPoint constructionPoint = new PointClass();
constructionPoint.ConstructDeflectionIntersection(line, startAngle, endAngle, false);
IPoint point = constructionPoint as IPoint;
System.Windows.Forms.MessageBox.Show("x,y = " + point.X + ", " + point.Y);
}
'+++ Constructs a point as the intersection of 2 lines with angles
'+++ dStartAngle (from the startpoint of the line) and dEndAngle.
'+++ The flag to force the line to the right side is turned off.
Public Sub t_ConstructDeflectionIntersection()
Dim pPointFrom As ESRI.ArcGIS.Geometry.IPoint
Dim pPointTo As ESRI.ArcGIS.Geometry.IPoint
Dim pLine As ESRI.ArcGIS.Geometry.ILine
Dim pPoint As ESRI.ArcGIS.Geometry.IPoint
Dim pCPoint As ESRI.ArcGIS.Geometry.IConstructPoint
Dim dStartAngle As Double
Dim dEndAngle As Double
Dim pi As Double
pPointFrom = New ESRI.ArcGIS.Geometry.Point
pPointTo = New ESRI.ArcGIS.Geometry.Point
pCPoint = New ESRI.ArcGIS.Geometry.Point
pPoint = New ESRI.ArcGIS.Geometry.Point
pLine = New ESRI.ArcGIS.Geometry.Line
pPointFrom.PutCoords(0, 0)
pPointTo.PutCoords(1, 0)
pLine.PutCoords(pPointFrom, pPointTo)
pi = 4 * Math.Atan(1)
dStartAngle = pi / 4
dEndAngle = pi / 4
pCPoint.ConstructDeflectionIntersection(pLine, dStartAngle, dEndAngle, False)
pPoint = pCPoint
MsgBox("x,y = " & pPoint.X & "," & pPoint.Y)
End Sub
IConstructPoint.ConstructOffset Method
Constructs a point distance units along the input curve and offset units perpendicularly away from it.
Public Sub ConstructOffset ( _
ByVal curve As ICurve, _
ByVal extension As esriSegmentExtension, _
ByVal distance As Double, _
ByVal asRatio As Boolean, _
ByVal Offset As Double _
)
public void ConstructOffset (
ICurve curve,
esriSegmentExtension extension,
double distance,
bool asRatio,
double Offset
);
Remarks
A positive Offset distance will create a point on the right side of the curve and a negative offset will create a point on the left side of the curve.Set the asRatio flag to be True if you want the distance to be a ratio of the curve length. If set to True, then a distance of 0.5 will be equal to half of the curve length (i.e. 50%).
//This example demonstrates how to use IConstructPoint.ConstructOffset method
private void ConstructOffset()
{
IPoint[] points = new IPoint[4];
for (int i = 0; i < 4; i++)
{
points[i] = new PointClass();
}
points[0].PutCoords(0, 0);
points[1].PutCoords(10, 0);
points[2].PutCoords(20, 0);
points[3].PutCoords(30, 0);
IPointCollection polyline = new Polyline();
//helper class to solve C-Style Array usage in COM classes
IGeometryBridge geometryBride = new GeometryEnvironmentClass();
geometryBride.AddPoints(polyline as IPointCollection4, ref points);
IConstructPoint constructionPoint = new PointClass();
//The spatial reference should be set on the new point here (Code skipped)
//Example 1: Distance No ratio, Positive offset
constructionPoint.ConstructOffset(polyline as ICurve, esriSegmentExtension.esriNoExtension, 15, false, 5);
IPoint outPutPoint1 = constructionPoint as IPoint;
System.Windows.Forms.MessageBox.Show("Output point : " + outPutPoint1.X + " , " + outPutPoint1.Y);
//Output point : 15 , -5
//*********************************************
//Example 2: Distance as ratio, Positive offset
constructionPoint.ConstructOffset(polyline as ICurve, esriSegmentExtension.esriNoExtension, 0.5, true, 5);
IPoint outPutPoint2 = constructionPoint as IPoint;
System.Windows.Forms.MessageBox.Show("Output point : " + outPutPoint2.X + " , " + outPutPoint2.Y);
//Output point : 15 , -5
//*********************************************
//Example 3: Distance No ratio, Negative offset
constructionPoint.ConstructOffset(polyline as ICurve, esriSegmentExtension.esriNoExtension, 15, false, -5);
IPoint outPutPoint3 = constructionPoint as IPoint;
System.Windows.Forms.MessageBox.Show("Output point : " + outPutPoint3.X + " , " + outPutPoint3.Y);
//Output point : 15 , 5
}
'This example demonstrates how to use IConstructPoint::ConstructOffset
Sub ConstructOffset()
Dim ptc As IPointCollection, pt(3) As IPoint, i As Long
Dim pconsPoint As IConstructPoint, ptout As IPoint
ptc = New Polyline
'The spatial reference should be set on the polyline here (Code skipped)
For i = 0 To 3
pt(i) = New Point
Next
pt(0).PutCoords(0, 0)
pt(1).PutCoords(10, 0)
pt(2).PutCoords(20, 0)
pt(3).PutCoords(30, 0)
ptc.AddPoints(4, pt(0))
'The spatial reference should be set on the new point here (Code skipped)
'*********************************************
'Example 1: Distance No ratio, Positive offset
pconsPoint = New Point
pconsPoint.ConstructOffset(ptc, esriSegmentExtension.esriNoExtension, 15, False, 5)
ptout = pconsPoint
Debug.Print("Output point : " & ptout.X & " , " & ptout.Y)
'Output point : 15 , -5
'*********************************************
'Example 2: Distance as ratio, Positive offset
pconsPoint = New Point
pconsPoint.ConstructOffset(ptc, esriSegmentExtension.esriNoExtension, 0.5, True, 5)
ptout = pconsPoint
Debug.Print("Output point : " & ptout.X & " , " & ptout.Y)
'Output point : 15 , -5
'*********************************************
'Example 3: Distance No ratio, Negative offset
pconsPoint = New Point
pconsPoint.ConstructOffset(ptc, esriSegmentExtension.esriNoExtension, 15, False, -5)
ptout = pconsPoint
Debug.Print("Output point : " & ptout.X & " , " & ptout.Y)
'Output point : 15 , 5
End Sub
IConstructPoint.ConstructParallel Method
Constructs a point distance units from start, parallel to the tangent at the point nearest to start on the (extended) segment.
Public Sub ConstructParallel ( _
ByVal Segment As ISegment, _
ByVal extension As esriSegmentExtension, _
ByVal start As IPoint, _
ByVal distance As Double _
)
public void ConstructParallel (
ISegment Segment,
esriSegmentExtension extension,
IPoint start,
double distance
);
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
IConstructPoint.ConstructPerpendicular Method
Constructs a point 'distance' units from p and lying along the line normal to base and passing through p.
Public Sub ConstructPerpendicular ( _
ByVal base As ISegment, _
ByVal extension As esriSegmentExtension, _
ByVal p As IPoint, _
ByVal distance As Double, _
ByVal bUseLineOrientation As Boolean _
)
public void ConstructPerpendicular (
ISegment base,
esriSegmentExtension extension,
IPoint p,
double distance,
bool bUseLineOrientation
);
Description
ConstructPerpendicular constructs a Point a specified distance from the input point in the direction parallel to the normal (perpendicular to the tangent) of the nearest point on the extended input segment.
Remarks
IConstructPoint.ConstructThreePointResection Method
Constructs the point of observation from which two signed angles between three points were measured; returns an angle which can help establish the confidence of the observation location: A small angle indicates greater uncertainty in the location.
Public Sub ConstructThreePointResection ( _
ByVal point1 As IPoint, _
ByVal angleP1P2 As Double, _
ByVal point2 As IPoint, _
ByVal angleP2P3 As Double, _
ByVal point3 As IPoint, _
ByRef arcAngle As Double _
)
public void ConstructThreePointResection (
IPoint point1,
double angleP1P2,
IPoint point2,
double angleP2P3,
IPoint point3,
ref double arcAngle
);
Description
The ConstructThreePointResection method constructs a new point given three points and two signed view angles. It finds the viewpoints from which the two point pairs are viewed at the given angles. When both angles are equal to pi/2 radians, there is only one solution; otherwise there can be up to four solutions. A positive angle indicates that the viewpoint is to be on the right hand side of the line between the corresponding points; a negative angle places the resulting point on the left. There may not be a feasible solution for the given input, in which case the resulting point is empty. The quality of the solution is given by the arcAngle parameter. The smaller the angle the less stable the solution. The returned angle is between 0 and pi/2.
Remarks
Given three points and two angles measured from the constructed point.Note that there is no unique solution if all three points are on the same circle.
Private Shared Sub t_ConstructThreePointResection()
On Error GoTo Errorhandler
Dim pPoint As IPoint
Dim pCPoint As IConstructPoint
Dim pPoint1 As IPoint
Dim pPoint2 As IPoint
Dim pPoint3 As IPoint
Dim dAngle1 As Double
Dim dAngle2 As Double
pCPoint = New Point
pPoint = New Point
pPoint1 = New Point
pPoint2 = New Point
pPoint3 = New Point
pPoint1.PutCoords(0, 1)
pPoint2.PutCoords(2, 2)
pPoint3.PutCoords(1, 0)
dAngle1 = Math.PI / 4
dAngle2 = Math.PI / 4
pCPoint.ConstructThreePointResection(pPoint1, dAngle1, pPoint2, dAngle2, pPoint3, Math.PI / 2)
pPoint = pCPoint
MsgBox("x,y = " & pPoint.X & "," & pPoint.Y)
Exit Sub
Errorhandler:
MsgBox(Err.Number & "..." & Err.Description)
Exit Sub
End Sub
Classes that implement IConstructPoint
Classes | Description |
---|---|
Point | A two dimensional point, optionally with measure, height, and ID attributes. |