IMSegmentation Interface

Provides access to members for defining an M-based linear coordinate system on a polyline or polygon.

Members

Name Description
Method CalculateNonSimpleMs Redefines the non-simple Ms to be values obtained from interpolation of surrounding defined Ms, or extrapolation of Ms.
Method ExtrapolateMs Extrapolates the Ms at one or both ends of the geometry based on the M interval between the fromIndex and the toIndex.
Method GetDistancesAtM Returns an array of distances along the polyline at which is located the specified M. If the geometry's M's are monotonic along the geometry then the array will only have one element.
Method GetMsAtDistance Returns M values at the distance along the geometry. An array of one or two Ms is returned. Two Ms can be returned if the given distance is exactly at the beginning or ending of a part.
Method GetPointsAtM Returns a multipoint geometry corresponding to the locations along the geometry where the specified M occurs.
Method GetSubcurveBetweenMs Returns a polyline geometry corresponding to the subcurve(s) between the fromM and the toM.
Method InsertMAtDistance Sets the M value at the given distance along the geometry; creates a point at that distance if no point exists there.
Method InterpolateMsBetween Generates Ms by linear interpolation of segment distances for all vertices in the range [start+1, end-1].
Read-only property MMax The maximum M value.
Read-only property MMin The minimum M value.
Read-only property MMonotonic A value indicating whether Ms are monotonic, and if so, whether they are ascending or descending.
Method MultiplyMs Multiplies all the M values by a factor.
Method OffsetMs Offsets all the M values by an offset value.
Method ReverseMsOrder Reverses the order of the Ms along the geometry.
Method SetAndInterpolateMsBetween Sets the Ms at the beginning and the end of the geometry and interpolates the M values between these values.
Method SetMsAsDistance Sets the M values to the cumulative length from the origin of the geometry.

IMSegmentation.CalculateNonSimpleMs Method

Redefines the non-simple Ms to be values obtained from interpolation of surrounding defined Ms, or extrapolation of Ms.

Public Sub CalculateNonSimpleMs ( _
)
public void CalculateNonSimpleMs (
);

IMSegmentation.ExtrapolateMs Method

Extrapolates the Ms at one or both ends of the geometry based on the M interval between the fromIndex and the toIndex.

Public Sub ExtrapolateMs ( _
    ByVal extrapolationStyle As esriExtrapolationEnum, _
    ByVal fromPart As Integer, _
    ByVal FromPoint As Integer, _
    ByVal toPart As Integer, _
    ByVal ToPoint As Integer _
)
public void ExtrapolateMs (
    esriExtrapolationEnum extrapolationStyle,
    int fromPart,
    int FromPoint,
    int toPart,
    int ToPoint
);

IMSegmentation.GetDistancesAtM Method

Returns an array of distances along the polyline at which is located the specified M. If the geometry's M's are monotonic along the geometry then the array will only have one element.

Public Function GetDistancesAtM ( _
    ByVal asRatio As Boolean, _
    ByVal M As Double _
) As Object
public object GetDistancesAtM (
    bool asRatio,
    double M
);

IMSegmentation.GetMsAtDistance Method

Returns M values at the distance along the geometry. An array of one or two Ms is returned. Two Ms can be returned if the given distance is exactly at the beginning or ending of a part.

Public Function GetMsAtDistance ( _
    ByVal distance As Double, _
    ByVal asRatio As Boolean _
) As Object
public object GetMsAtDistance (
    double distance,
    bool asRatio
);
public void GetMsAtPoint(IPolyline polyline, IPoint point)

    {

        /*

        This function does NOT assume that the point is on top of the PolyLine.

        If the point is equally distant from more that one location along the

        PolyLine, this function returns the all the M values.

        Note: You may notice some wierd behavior if the point falls on the

              end of a part as we will use distance in this function

        */

        IMAware mAware = polyline as IMAware;

        if (mAware.MAware)

        {

            IPoint outPoint = new PointClass();

            double distanceAlongCurve = 0;

            double distanceFromCurve = 0;

            bool isOnRightSide = false;

            ICurve curve = polyline as ICurve; curve.QueryPointAndDistance(esriSegmentExtension.esriNoExtension, point, false, outPoint, ref distanceAlongCurve, ref distanceFromCurve, ref isOnRightSide); IMSegmentation mSegmentation = curve as IMSegmentation; object mArrayObject = mSegmentation.GetMsAtDistance(distanceAlongCurve, false);

            double[] mArray = mArrayObject as double[];

            //print Ms

            for (int i = 0; i < mArray.Length; i++)

            {

                System.Windows.Forms.MessageBox.Show(mArray[i].ToString());

            }

        }

    }
Public Sub GetMsAtPoint(ByVal pPl As IPolyline, ByVal pPt As IPoint)

        '+++ This function does not assume that the point is on top of the PolyLine.

        '+++ If the point is equally distant from more that one location along the

        '+++ PolyLine, this function returns the all the M values.

        '+++ Here is how to find the M values returned by this function:

        '      Dim Ms

        '      Dim i As Long

        '      Ms = GetMsAtPoint(pPL, pPt)

        '      For i = LBound(Ms) To UBound(Ms)

        '        Debug.Print Ms(i)

        '      Next i

        '+++ Note: You may notice some wierd behavior if the point falls on the

        '+++       end of a part as we will use distance in this function

        Dim pMA As IMAware

        Dim pCurve As ICurve

        Dim pTmpPt As IPoint, dAlong As Double, dFrom As Double, bRight As Boolean

        Dim pMSeg As IMSegmentation

        Dim Ms As Double

        pMA = pPl

        If pMA.MAware Then

            pCurve = pPl

            pCurve.QueryPointAndDistance(esriSegmentExtension.esriNoExtension, pPt, False, pTmpPt, dAlong, dFrom, bRight)

            pMSeg = pCurve

            Ms = pMSeg.GetMsAtDistance(dAlong, False)

        Else

            Err.Raise(vbObjectError + 11282000, "GetMsAtPoint", "Not M Aware")

        End If

    End Sub

IMSegmentation.GetPointsAtM Method

Returns a multipoint geometry corresponding to the locations along the geometry where the specified M occurs.

Public Function GetPointsAtM ( _
    ByVal M As Double, _
    ByVal lateralOffset As Double _
) As IGeometryCollection
public IGeometryCollection GetPointsAtM (
    double M,
    double lateralOffset
);

IMSegmentation.GetSubcurveBetweenMs Method

Returns a polyline geometry corresponding to the subcurve(s) between the fromM and the toM.

Public Function GetSubcurveBetweenMs ( _
    ByVal fromM As Double, _
    ByVal toM As Double _
) As IGeometryCollection
public IGeometryCollection GetSubcurveBetweenMs (
    double fromM,
    double toM
);

IMSegmentation.InsertMAtDistance Method

Sets the M value at the given distance along the geometry; creates a point at that distance if no point exists there.

Public Sub InsertMAtDistance ( _
    ByVal M As Double, _
    ByVal distance As Double, _
    ByVal asRatio As Boolean, _
    ByVal createPart As Boolean, _
    ByRef SplitHappened As Boolean, _
    ByRef newPartIndex As Integer, _
    ByRef newSegmentIndex As Integer _
)
public void InsertMAtDistance (
    double M,
    double distance,
    bool asRatio,
    bool createPart,
    ref bool SplitHappened,
    ref int newPartIndex,
    ref int newSegmentIndex
);

IMSegmentation.InterpolateMsBetween Method

Generates Ms by linear interpolation of segment distances for all vertices in the range [start+1, end-1].

Public Sub InterpolateMsBetween ( _
    ByVal fromPart As Integer, _
    ByVal FromPoint As Integer, _
    ByVal toPart As Integer, _
    ByVal ToPoint As Integer _
)
public void InterpolateMsBetween (
    int fromPart,
    int FromPoint,
    int toPart,
    int ToPoint
);

IMSegmentation.MMonotonic Property

A value indicating whether Ms are monotonic, and if so, whether they are ascending or descending.

Public ReadOnly Property MMonotonic As esriMMonotonicEnum
public esriMMonotonicEnum MMonotonic {get;}

Description

Returns an esriMMonotonicEnum indicating whether or not the Ms are monotonic as well as whether they are ascending or descending. The Ms are esriMAscending if the Ms are ordered such that M1 < M2 < M3 < . . . < Mn. The Ms are esriMDescending if the Ms are ordered such that M1 > M2 > M3 > . . . > Mn.

IMSegmentation.ReverseMsOrder Method

Reverses the order of the Ms along the geometry.

Public Sub ReverseMsOrder ( _
)
public void ReverseMsOrder (
);

Remarks

Note that the m values are simply reversed. Any length:measure ratios that were present before ReverseMsOrder is called are not preserved.

IMSegmentation.SetAndInterpolateMsBetween Method

Sets the Ms at the beginning and the end of the geometry and interpolates the M values between these values.

Public Sub SetAndInterpolateMsBetween ( _
    ByVal fromM As Double, _
    ByVal toM As Double _
)
public void SetAndInterpolateMsBetween (
    double fromM,
    double toM
);

IMSegmentation.SetMsAsDistance Method

Sets the M values to the cumulative length from the origin of the geometry.

Public Sub SetMsAsDistance ( _
    ByVal asRatio As Boolean _
)
public void SetMsAsDistance (
    bool asRatio
);

Inherited Interfaces

Interfaces Description
IMCollection Provides access to members that control operations on M-aware multipoints, polylines, polygons and multipatches.

Classes that implement IMSegmentation

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.

Remarks

The IMSegmentation interface provides methods designed to work with the dynamic segmentation functionality in ArcObjects. The CalculateNonSimpleMs method will interpolate or extrapolate missing (NaN) measure values, based on the existing values. Use the ExtrapolateMsor InterpolateMsBetween methods to set m attributes for only the specified vertices of a PolyLine. InsertMAtDistance will update a single vertex's m attribute, or if the specified distance does not fall on a vertex, a new vertex will be inserted into the PolyLine at that location.

IMSegmentation also provides methods to query a measured PolyLine, based on its m attributes. For example GetSubCurveBetweenMs and GetPointsAtM can be used to find geometries along a measured PolyLine. Note that if the m attributes do not monotonically increase along the line (check the MMonotonic property), the result of GetSubcurveBetweenMs may have more than one part or the result of GetPointsAtM will have more than one point.

The CalculateNonSimpleMs, SetAndInterpolateMsBetween, and SetMsAsDistance methods all ensure a PolyLine is MSimple.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.