UI 에서이 작업을 수행하는 도구는 알지 못하지만 프로그래밍 방식으로 IMSegmentation3 인터페이스 를 통해 수행 할 수 있습니다 .
protected override void OnClick()
{
try
{
var fSel = ArcMap.Document.FocusMap.get_Layer(1) as IFeatureSelection;
if (fSel.SelectionSet.Count == 0)
{
MessageBox.Show("choose a line feature first");
return;
}
var gc = ArcMap.Document.FocusMap as IGraphicsContainer;
IFeature feat = ((IFeatureLayer)fSel).FeatureClass.GetFeature(fSel.SelectionSet.IDs.Next());
var pnts = GetPoints((IPolyline)feat.ShapeCopy, 2.0);
foreach (IPoint pnt in pnts)
{
var elem = new MarkerElementClass() as IElement;
elem.Geometry = pnt;
((IMarkerElement)elem).Symbol = new SimpleMarkerSymbolClass();
gc.AddElement(elem, 0);
}
((IActiveView)ArcMap.Document.FocusMap).PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
/// <summary>
/// Get points at evenly spaced measures along a polyline
/// </summary>
/// <param name="polyline"></param>
/// <param name="count"></param>
/// <returns></returns>
private List<IPoint> GetPoints(IPolyline polyline, double mspacing)
{
var outList = new List<IPoint>();
var mseg = polyline as IMSegmentation3;
if (mseg.MMonotonic == esriMMonotonicEnum.esriMNotMonotonic)
throw new Exception("polyline not monotonic");
for (double m = mseg.MMin; m <= mseg.MMax; m += mspacing)
{
var geomcoll = mseg.GetPointsAtM(m, 0.0);
if (geomcoll != null && geomcoll.GeometryCount > 0)
{
var pnt = geomcoll.get_Geometry(0) as IPoint;
outList.Add(pnt);
}
}
return outList;
}