This document is archived and information here might be outdated.  Recommended version.


IConstructCurve.ConstructOffset Method (ArcObjects .NET 10.5 SDK)
ArcObjects Library Reference (Geometry)  

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.

[Visual Basic .NET]
Public Sub ConstructOffset ( _
    ByVal inCurve As IPolycurve, _
    ByVal Offset As Double, _
    [ByRef offsetHow As Object], _
    [ByRef bevelRatio As Object] _
)
[C#]
public void ConstructOffset (
    IPolycurve inCurve,
    double Offset,
    ref object offsetHow,
    ref object bevelRatio
);
[C#]

Optional Values

offsetHow   To indicate that this parameter is undefined, first define a variable object Missing=Type.Missing; then pass this in as ref Missing.
bevelRatio   To indicate that this parameter is undefined, first define a variable object Missing=Type.Missing; then pass this in as ref Missing.
[C++]
HRESULT ConstructOffset(
  IPolycurve* inCurve,
  double Offset,
  VARIANT* offsetHow,
  VARIANT* bevelRatio
);
[C++]

Parameters inCurve
inCurve is a parameter of type IPolycurve Offset Offset is a parameter of type double offsetHow [optional] offsetHow is a parameter of type VARIANT
To indicate this parameter is undefined pass a reference to a VARIANT with type VT_ERROR and scode value of DISP_E_PARAMNOTFOUND. bevelRatio [optional] bevelRatio is a parameter of type VARIANT
To indicate this parameter is undefined pass a reference to a VARIANT with type VT_ERROR and scode value of DISP_E_PARAMNOTFOUND.

Product Availability

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

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. 

[C#]

//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;
}

[Visual Basic .NET]

    '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

See Also

IConstructCurve Interface