Engnie中如何创建贝塞尔曲线(Bezier Curve)?

Engnie中如何创建贝塞尔曲线?
已邀请:

刘峥 - ArcGIS多面手

赞同来自:

【问题分析】:
使用IBeizerCurve接口不成功
【解决办法】:
官方帮助文档推荐使用IBezierCurveGEN接口
IPoint controlPoints = new IPoint[4]; 
controlPoints[0] = new ESRI.ArcGIS.Geometry.Point();
controlPoints[1] = new ESRI.ArcGIS.Geometry.Point();
controlPoints[2] = new ESRI.ArcGIS.Geometry.Point();
controlPoints[3] = new ESRI.ArcGIS.Geometry.Point();

controlPoints[0].PutCoords(0, 10);
controlPoints[1].PutCoords(10, 10);
controlPoints[2].PutCoords(0, 0);
controlPoints[3].PutCoords(10, 0);

IBezierCurveGEN bezier = new BezierCurveClass();
bezier.PutCoords(ref controlPoints);
IBezierCurve bezierCurve = bezier as IBezierCurve;

object Missing = Type.Missing;
ISegmentCollection pSegmentCollection = new PolylineClass();
pSegmentCollection.AddSegment(bezierCurve as ISegment, ref Missing, ref Missing);
IPolyline pPolyline = pSegmentCollection as IPolyline;

ISimpleLineSymbol pSimpleLineSymbol = new SimpleLineSymbolClass();
pSimpleLineSymbol.Width = 2;

IActiveView pActiveView = axMapControl1.Map as IActiveView;
IScreenDisplay pScreenDisplay = pActiveView.ScreenDisplay;
pScreenDisplay.StartDrawing(pScreenDisplay.hDC, 0);
pScreenDisplay.SetSymbol(pSimpleLineSymbol as ISymbol);
pScreenDisplay.DrawPolyline(pPolyline);
pScreenDisplay.FinishDrawing();

要回复问题请先登录注册