Parameters
- geometry
- The input geometry. Cannot be a GeometryBag.
- offset
- The offset value to add to each M-value.
| Exception | Description |
|---|---|
| System.ArgumentNullException | Geometry is null. |
| System.InvalidOperationException | This geometry is not M-Aware. |
| System.NotImplementedException | This method is not implemented for GeometryBag. |
{
// Create a polyline and add an offset of 2 to each of the M-values
MapPointBuilderEx pointBuilder = new(0, 0)
{
M = 1
};
MapPoint point1 = pointBuilder.ToGeometry();
pointBuilder.SetValues(2, 2);
pointBuilder.M = 3;
MapPoint point2 = pointBuilder.ToGeometry();
polyline = PolylineBuilderEx.CreatePolyline([point1, point2], AttributeFlags.HasM); ;
Polyline outPolyline = GeometryEngine.Instance.OffsetMs(polyline, 2) as Polyline;
// The xy-values of the points in outPolyline are the same as the points in the input polyline.
// The M-values in outPolyline are { 3, 5 }
// Create an envelope and add an offset of 25 to each of the M-values
EnvelopeBuilderEx envelopeBuilder = new(-5, 1, 2, 4)
{
MMin = 10,
MMax = 20
};
Envelope envelope = envelopeBuilder.ToGeometry();
Envelope outEnvelope = GeometryEngine.Instance.OffsetMs(envelope, 25) as Envelope;
// The xy-values of the points in outEnvelope are the same as the points in the input envelope.
// outEnvelope.MMin = 35, outEnvelope.MMax = 45
// Add a negative offset to the M-values of the envelope
outEnvelope = GeometryEngine.Instance.OffsetMs(envelope, -10) as Envelope;
// The xy-values of the points in outEnvelope are the same as the points in the input envelope.
// outEnvelope.MMin = 0, outEnvelope.MMax = 10
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)