Provides access to members that construct a curve using other geometries and measures.
Description
IConstructCurve contains methods used to create specialized Polylines or Polygons from input curves. ConstructOffset is used to create the right or left offset of a given curve. ConstructExtended extends a curve according to the desired extension method.
Members
Name | Description | |
---|---|---|
ConstructExtended | Constructs an extended version of the 'from' curve that goes to the 'to' curve. The flags are bit-wise combined esriCurveExtension values. | |
ConstructKoch | Constructs a Koch snowflake fractal using the input polycurve as the generator. 'r' is not used. Do not use a value for recursionLevel > 10. | |
ConstructOffset | Constructs a curve being the locus of points offset a given distance from another curve. See the enumeration esriConstructOffsetEnum to information on different ways that offset curve can be generated. |
IConstructCurve.ConstructExtended Method
Constructs an extended version of the 'from' curve that goes to the 'to' curve. The flags are bit-wise combined esriCurveExtension values.
Public Sub ConstructExtended ( _
ByVal fromCurve As ICurve, _
ByVal toCurve As ICurve, _
ByVal extensionFlags As Integer, _
ByRef extensionsPerformed As Boolean _
)
public void ConstructExtended (
ICurve fromCurve,
ICurve toCurve,
int extensionFlags,
ref bool extensionsPerformed
);
Remarks
This method will return an empty geometry if you attempt to create a polygon from two linear
geometries as input. This is not a way to create a polygon from two polylines.
If the input curve is a polygon the result will be a copy of the polygon.
The flags are bit-wise combined esriCurveExtension values.
private void ConstructExtended()
{
//Segment 0
IPoint point0 = new PointClass();
point0.PutCoords(0, 0);
IPoint point1 = new PointClass();
point1.PutCoords(10, 10);
ILine segment0 = new LineClass();
segment0.PutCoords(point0, point1);
//Segment 1
IPoint point2 = new PointClass();
point2.PutCoords(10, 10);
IPoint point3 = new PointClass();
point3.PutCoords(10, 0);
ILine segment1 = new LineClass();
segment1.PutCoords(point2, point3);
//Segment 2
IPoint point4 = new PointClass();
point4.PutCoords(10, 0);
IPoint point5 = new PointClass();
point5.PutCoords(0, 0);
ILine segment2 = new LineClass();
segment2.PutCoords(point4, point5);
//Polygon
object Missing = Type.Missing;
ISegmentCollection segmentCollection = new PolygonClass();
segmentCollection.AddSegment(segment0 as ISegment, ref Missing, ref Missing);
segmentCollection.AddSegment(segment1 as ISegment, ref Missing, ref Missing);
segmentCollection.AddSegment(segment2 as ISegment, ref Missing, ref Missing);
ICurve curve = segmentCollection as ICurve;
//Line
IPoint point6 = new PointClass();
point6.PutCoords(-10, 20);
IPoint point7= new PointClass();
point7.PutCoords(0, 5);
ILine line = new Line();
line.PutCoords(point6, point7);
//Polyline
ISegmentCollection polyLineSegmentCollection = new PolylineClass();
polyLineSegmentCollection.AddSegment(line as ISegment, ref Missing, ref Missing);
ICurve curve1 = polyLineSegmentCollection as ICurve;
//Construct the extend
IConstructCurve constructCurve = new PolylineClass();
bool isExtensionPerfomed = false;
constructCurve.ConstructExtended(curve, curve1, (int) esriCurveExtension.esriDefaultCurveExtension, ref isExtensionPerfomed);
}
Private Sub ConstructExtended()
Dim pConstructCurve As ESRI.ArcGIS.Geometry.IConstructCurve
Dim pCurve1 As ESRI.ArcGIS.Geometry.ICurve
Dim pCurve2 As ESRI.ArcGIS.Geometry.ICurve
Dim pPolyLineGeoColl As ESRI.ArcGIS.Geometry.ISegmentCollection
Dim pPolygonGeoColl As ESRI.ArcGIS.Geometry.ISegmentCollection
Dim pSeg0 As ESRI.ArcGIS.Geometry.ILine
Dim pSeg1 As ESRI.ArcGIS.Geometry.ILine
Dim pSeg2 As ESRI.ArcGIS.Geometry.ILine
Dim pLine As ESRI.ArcGIS.Geometry.ILine
Dim pPt0 As ESRI.ArcGIS.Geometry.IPoint
Dim pPt1 As ESRI.ArcGIS.Geometry.IPoint
Dim bExtensionPerformed As Boolean
'Points
pPt0 = New ESRI.ArcGIS.Geometry.Point
pPt1 = New ESRI.ArcGIS.Geometry.Point
'Segment 0
pSeg0 = New ESRI.ArcGIS.Geometry.Line
pPt0.PutCoords(0, 0)
pPt1.PutCoords(10, 10)
pSeg0.PutCoords(pPt0, pPt1)
'Segment 1
pSeg1 = New ESRI.ArcGIS.Geometry.Line
pPt0.PutCoords(10, 10)
pPt1.PutCoords(10, 0)
pSeg1.PutCoords(pPt0, pPt1)
'Segment 2
pSeg2 = New ESRI.ArcGIS.Geometry.Line
pPt0.PutCoords(10, 0)
pPt1.PutCoords(0, 0)
pSeg2.PutCoords(pPt0, pPt1)
'Polygon
pPolygonGeoColl = New ESRI.ArcGIS.Geometry.Polygon
pPolygonGeoColl.AddSegment(pSeg0)
pPolygonGeoColl.AddSegment(pSeg1)
pPolygonGeoColl.AddSegment(pSeg2)
pCurve2 = pPolygonGeoColl
'Line
pLine = New ESRI.ArcGIS.Geometry.Line
pPt0.PutCoords(-10, 20)
pPt1.PutCoords(0, 5)
pLine.PutCoords(pPt0, pPt1)
'Polyline
pPolyLineGeoColl = New ESRI.ArcGIS.Geometry.Polyline
pPolyLineGeoColl.AddSegment(pLine)
pCurve1 = pPolyLineGeoColl
'Construct the extend
pConstructCurve = New ESRI.ArcGIS.Geometry.Polyline
pConstructCurve.ConstructExtended(pCurve1, pCurve2, ESRI.ArcGIS.Geometry.esriCurveExtension.esriDefaultCurveExtension, bExtensionPerformed)
End Sub
IConstructCurve.ConstructKoch Method
Constructs a Koch snowflake fractal using the input polycurve as the generator. 'r' is not used. Do not use a value for recursionLevel > 10.
Public Sub ConstructKoch ( _
ByVal p As IPolycurve, _
ByVal r As Double, _
ByVal recursionLevel As Integer _
)
public void ConstructKoch (
IPolycurve p,
double r,
int recursionLevel
);
Description
ConstructKoch creates a Koch fractal from the given input curve. It treats all segments as linear segments (ie. All CircularArcs, BezierCurves, and EllipticArc as treated like lines between the From and To Points.).
Remarks
IConstructCurve.ConstructOffset Method
Constructs a curve being the locus of points offset a given distance from another curve. See the enumeration esriConstructOffsetEnum to information on different ways that offset curve can be generated.
Public Sub ConstructOffset ( _
ByVal inCurve As IPolycurve, _
ByVal Offset As Double, _
[ByRef offsetHow As Object], _
[ByRef bevelRatio As Object] _
)
public void ConstructOffset (
IPolycurve inCurve,
double Offset,
ref object offsetHow,
ref object bevelRatio
);
Description
ConstructOffset constructs the offset of the given input Polycurve. If the offset parameter is positive, the constructed offset will be on the right side of the curve (left side offsets are constructed with negative offset parameters). Tracing the curve from it's first vertex to the last will give you a direction along the curve. It is to the right and left respective of this direction that the positive and negative parameters will dictate where the offset is constructed. In these terms it is simple to infer where the offset of even horizontal polycurves will be constructed. The offsetHow parameter determines how outer corners between segments are handled. Rounded offset rounds the corner between extended offsets. Bevelled offset squares off the corner after a given ratio distance. Mitered offset attempts to allow extended offsets to naturally intersect, but if that intersection occurs too far from the corner, the corner is eventually bevelled off at a fixed distance.
Remarks
This results produced by this method are sensitive to large offset distances, particularly when the offset distance is larger than the length of the segments in the reference geometry. The remove self intersecting arcs feature is particularly problematic when extremely large offsets are involved.
The sides of the curve are determined from the order of the vertices of the curve. Tracing the curve from the first vertex to the last will give you a direction along the curve it is to the right and left of this direction that the positive and negative parameters will dictate where the offset is constructed. In these terms it is simple to infer where the offset will be constructed.
One alternative is to use buffer to generate the offsets.
//This example demonstrate how to use IConstructCurve::ConstructOffset
private IPolyline ConstructOffset(IPolyline inPolyline, double offset)
{
if (inPolyline == null || inPolyline.IsEmpty)
{
return null;
}
object Missing = Type.Missing;
IConstructCurve constructCurve = new PolylineClass();
constructCurve.ConstructOffset(inPolyline, offset, ref Missing, ref Missing);
return constructCurve as IPolyline;
}
'This example demonstrate how to use IConstructCurve::ConstructOffset
Private Function ConstructOffset(ByVal pInPolyline As IPolyline, ByVal dOffset As Double) As IPolyline
Dim pConstructCurve As IConstructCurve
On Error GoTo ErrorHandler
If pInPolyline Is Nothing Or pInPolyline.IsEmpty Then
ConstructOffset = Nothing
Exit Function
End If
pConstructCurve = New Polyline
pConstructCurve.ConstructOffset(pInPolyline, dOffset, esriConstructOffsetEnum.esriConstructOffsetRounded + esriConstructOffsetEnum.esriConstructOffsetSimple)
ConstructOffset = pConstructCurve
Exit Function
ErrorHandler:
ConstructOffset = Nothing
End Function
Classes that implement IConstructCurve
Classes | Description |
---|---|
Polygon | A collection of rings ordered by their containment relationship; optionally has measure, height and ID attributes. |
Polyline | An ordered collection of paths; optionally has measure, height and ID attributes. |