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


IMSegmentation2.CalibrateByMs Method (ArcObjects .NET 10.4 SDK)
ArcObjects Library Reference (Geometry)  

IMSegmentation2.CalibrateByMs Method

Calibrates Ms of existing vertices using new Ms from the input points and existing Ms along shortest paths between those points. The update method is given as a combination of esriGeometryUpdateMEnum values.

[Visual Basic .NET]
Public Function CalibrateByMs ( _
    ByVal Points As IEnumVertex, _
    ByVal updateHow As Integer, _
    ByVal cutoffDistance As Double _
) As IEnumSplitPoint
[C#]
public IEnumSplitPoint CalibrateByMs (
    IEnumVertex Points,
    int updateHow,
    double cutoffDistance
);
[C++]
HRESULT CalibrateByMs(
  IEnumVertex* Points,
  long updateHow,
  double cutoffDistance,
  IEnumSplitPoint** splitPoints
);
[C++]

Parameters Points
Points is a parameter of type IEnumVertex updateHow updateHow is a parameter of type long cutoffDistance cutoffDistance is a parameter of type double splitPoints [out, retval]
splitPoints is a parameter of type IEnumSplitPoint

Product Availability

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

Remarks

The updateHow argument is given as a combination of esriGeometryUpdateMEnum values. When combining multiple values, the bitwise Or operator should always be used. This assures an error-free combination of the values (as long as the attempted combination is valid). Do not use the addition operator (+) to combine the values as unexpected results may occur.

The cutoffDistance parameter is an input Double that represents the distance from the polyline from where points are not considered anymore as being valid calibration points.

For example, to interpolate between the input points and to extrapolate before and after the input points, you would use 7, which equates to: esriGeometryInterpolate OR esriGeometryExtrapolateBefore OR esriGeometryExtrapolateAfter

esriGeometryInterpolate=0001 (1)
esriGeometryExtrapolateBefore=0010 (2)
esriGeometryExtrapolateAfter=0100 (4)

     0001
        0010
        0100
        ----
        0111
[C#]

public void CalibratePolyLineByMs(IPolyline polyline, IMultipoint multipoint, int updateHow, double cutOffDistance)
{
  /*
   This function will use IMSegmentation2.CalibrateByMs. This function
   calibrates the Ms using measure distance. If you want to calibrate using
   some existing geometric distance, then use IMSegmentation2.CalibrateByDistance
 
   updateHow is a bitwise combination of these three values:
         esriGeometryInterpolate=1
         esriGeometryExtrapolateBefore=2
         esriGeometryExtrapolateAfter=4
 
   Note that CalibrateByMs does not require that the MultiPoint's points
   fall on top of the PolyLine. You might consider adding some logic to make
   sure that the points fall on top of (e.g. ITopologicalOperator.Intersect)
   or are within a tolerance (e.g. IProximityOperator.ReturnDistance)
 
   If you pass in a PolyLine that is from a data source of unknown quality,
   you may consider calling IGeometryCollection.GeometriesChanged before
   you call IPolyLine.SimplifyNetwork below. This is because SimplifyNetwork
   will not do anything if the geometry is assumed to be simple. Calling
   GeometriesChanged tells the geometry that it is not simple.
 
   This operation must be performed on a simple geometry
  */

  //This operation must be performed on a simple geometry
  polyline.SimplifyNetwork();
  
  //The MultiPoint's points should have Ms
  IMAware mAware=multipoint as IMAware;
  if(!mAware.MAware)
  {
    return;
  }
  //The PolyLine should be M Aware as well.
  mAware=polyline as IMAware;
  if(!mAware.MAware)
  {
    return;
  }
  IMSegmentation2 mSegmentation=polyline as IMSegmentation2;
  IPointCollection pointCollection=multipoint as IPointCollection;
  IEnumVertex enumVertex=pointCollection.EnumVertices;
  IEnumSplitPoint enumSplitPoint=mSegmentation.CalibrateByMs(enumVertex, updateHow, cutOffDistance);

  //Note that we do nothing with enumSplitPoint. IEnumSplitPoint specializes
  //IEnumVertex and gives additional information about the locations in a
  //PolyLine where it was split by a set of input points
 
}

[Visual Basic .NET]

    Public Sub CalibratePolyLineByMs(ByVal pPl As ESRI.ArcGIS.Geometry.IPolyline, ByVal pMP As ESRI.ArcGIS.Geometry.IMultipoint, ByVal updateHow As Long, ByVal dCutOffDist As Double)
        '+++ This function will use IMSegmentation2::CalibrateByMs. This function 
        '+++ calibrates the Ms using measure distance. If you want to calibrate using 
        '+++ some existing geometric distance, then use IMSegmentation2::CalibrateByDistance   
        '+++ updateHow is a bitwise combination of these three values: 
        '+++       esriGeometryInterpolate=1 
        '+++       esriGeometryExtrapolateBefore=2 
        '+++       esriGeometryExtrapolateAfter=4   
        '+++ Note that CalibrateByMs does not require that the MultiPoint's points 
        '+++ fall on top of the PolyLine. You might consider adding some logic to make 
        '+++ sure that the points fall on top of (e.g. ITopologicalOperator::Intersect) 
        '+++ or are within a tolerance (e.g. IProximityOperator::ReturnDistance)   
        '+++ If you pass in a PolyLine that is from a data source of unknown quality, 
        '+++ you may consider calling IGeometryCollection::GeometriesChanged before 
        '+++ you call IPolyLine::SimplifyNetwork below. This is because SimplifyNetwork 
        '+++ will not do anything if the geometry is assumed to be simple. Calling 
        '+++ GeometriesChanged tells the geometry that it is not simple.   
        '+++ This operation must be performed on a simple geometry 
        pPl.SimplifyNetwork()
        Dim pMA As ESRI.ArcGIS.Geometry.IMAware
        Dim pMSeg As ESRI.ArcGIS.Geometry.IMSegmentation2
        '+++ The MultiPoint's points should have Ms 
        pMA=pMP
        If Not pMA.MAware Then
            Err.Raise(vbObjectError + 11282000, "CalibratePolyLineByMs", "MultiPoint Not M Aware")
        End If

        '+++ The PolyLine should be M Aware as well. 
        pMA=Nothing
        pMA=pPl
        If Not pMA.MAware Then
            Err.Raise(vbObjectError + 11282000, "CalibratePolyLineByMs", "PolyLine Not M Aware")
        Else
            Dim pPC As ESRI.ArcGIS.Geometry.IPointCollection
            Dim pEnumV As ESRI.ArcGIS.Geometry.IEnumVertex
            Dim pEnumSp As ESRI.ArcGIS.Geometry.IEnumSplitPoint
            pMSeg=pMA
            pPC=pMP
            pEnumV=pPC.EnumVertices
            pEnumSp=pMSeg.CalibrateByMs(pEnumV, updateHow, dCutOffDist)
        End If
        '+++ Note that we do nothing with pEnumSp. IEnumSplitPoint specializes 
        '+++ IEnumVertex and gives additional information about the locations in a 
        '+++ PolyLine where it was split by a set of input points
    End Sub

See Also

IMSegmentation2 Interface | IMSegmentation2.CalibrateByDistance Method