几何对象Gemetry及DrawShape方法的注意事项
2009-07-16 09:11
309 查看
几何对象Gemetry及DrawShape方法的注意事项 由 Admin 发布于 2007年9月26日 DrawShape 方法只支持以下对象,而Line等对象不被支持 Geometry objects implementing IEnvelope, IMultiPatch, IMultiPoint, IPoint, IPolygon and IPolyline are supported |
DrawShape draws the supplied geometry onto the display. Use the DrawShape method within the esriViewForeground phase of the IMapControlEvents2::OnAfterDraw event. FlashShape flashes the supplied geometry onto the display. DrawShape 方法只支持以下对象,而Line等对象不被支持 Geometry objects implementing IEnvelope, IMultiPatch, IMultiPoint, IPoint, IPolygon and IPolyline are supported public partial class Form1 : Form { ILine m_line; public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void axMapControl1_OnMouseDown(object sender, ESRI.ArcGIS.Controls.IMapControlEvents2_OnMouseDownEvent e) { if (e.button == 1) { IPoint fromPoint = new PointClass(); fromPoint.PutCoords(100, 100); IPoint toPoint = new PointClass(); toPoint.PutCoords(150, 150); ILine line = new LineClass(); line.PutCoords(fromPoint, toPoint); Console.WriteLine(line.Length.ToString()); m_line = line; axMapControl1.FullExtent = line.Envelope; IEnvelope pRect = new EnvelopeClass(); pRect = axMapControl1.Extent; pRect.Expand(2, 2, true); axMapControl1.Extent = pRect; axMapControl1.Refresh(esriViewDrawPhase.esriViewForeground, Type.Missing, Type.Missing); } if (e.button == 2) { axMapControl1.Extent = axMapControl1.TrackRectangle(); } } private IRgbColor GetRGBColor(int red, int green, int blue) { //Create rgb color and grab hold of the IRGBColor interface IRgbColor rGB = new RgbColorClass(); //Set rgb color properties rGB.Red = red; rGB.Green = green; rGB.Blue = blue; rGB.UseWindowsDithering = true; return rGB; } private void axMapControl1_OnAfterDraw(object sender, IMapControlEvents2_OnAfterDrawEvent e) { if (e.viewDrawPhase == (int)esriViewDrawPhase.esriViewForeground & m_line != null) { ILineSymbol lineSymbol = new SimpleLineSymbolClass(); //Set line symbol properties lineSymbol.Color = GetRGBColor(0, 0, 0); lineSymbol.Width = 2; object oLineSymbol = lineSymbol; IPolyline m_Polyline = new PolylineClass(); ISegmentCollection pSeg = m_Polyline as ISegmentCollection; object Missing = Type.Missing; pSeg.AddSegment((ISegment)m_line, ref Missing, ref Missing); axMapControl1.DrawShape(m_Polyline, ref oLineSymbol); } } } |
相关文章推荐
- 关于java调用对象,方法的注意事项
- Android使用Parcelable传递对象方法及注意事项
- JAVA中String对象split方法注意事项
- 面向对象_方法重写的注意事项
- cocos2d一些注意事项及vector删除对象的方法
- ECharts图表初级入门(三):ECharts对象的数据实例化方法汇总以及注意事项
- JS的window对象下的属性的方法和注意事项
- JAVA中String对象split方法注意事项(切记其中的正则表达式)
- C++ 与“类”有关的注意事项总结(十):类对象数组初始化(三种方法)
- js对象中原型(prototype)的使用方法、替换以及注意事项
- 面向对象_构造方法的重载及注意事项
- Android使用Parcelable传递对象方法及注意事项
- Android使用Parcelable传递对象方法及注意事项
- Android使用Parcelable传递对象方法及注意事项
- 判断该对象是否是该类的对象的方法/内部类的注意事项
- 面向对象_继承中构造方法的注意事项
- BindingSource的EndEdit方法注意事项
- MAK代理激活的使用方法和注意事项
- WIN7系统安装INVENTOR注意事项及INVENTOR转CAD文件的方法
- 《蓝牙转串口模块使用注意事项》--方法一