几何对象Gemetry及DrawShape方法的注意事项
来源:互联网 发布:c语言命名规范 编辑:程序博客网 时间:2024/06/05 14:44
由 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);
}
}
}
- 几何对象Gemetry及DrawShape方法的注意事项
- cocos2d一些注意事项及vector删除对象的方法
- 面向对象_构造方法的重载及注意事项
- Mat对象的使用及注意事项
- 面向对象_方法重写的注意事项
- Android使用Parcelable传递对象方法及注意事项
- Android使用Parcelable传递对象方法及注意事项
- PYTHON+APACHE的方法及注意事项
- OSGI bundle的打包方法及注意事项
- 脚本调用的方法及注意事项
- allegro添加泪滴的方法及注意事项
- 重庆老烂腿的治疗方法及注意事项
- UIView 的常用方法及注意事项
- 应用程序访问底层的方法及注意事项
- 生成随机数的方法及注意事项()
- StringBuffer的常见方法及注意事项
- 基于OCCI的空间数据库几何对象实现方法研究
- 抽象方法及注意事项
- 专家访谈:《编译原理》课程教学的探讨
- gethostbyname用法
- 给点建议啊!
- yum 安装 PHP
- 为什么VB.net的Shared(共享)方法在C#中叫Static(静态)?
- 几何对象Gemetry及DrawShape方法的注意事项
- 设计模式学习(二)
- 一道加解密的面试题
- Eclipse安装配置手册
- 怎样使用《Felomeng家庭理财》进行理财?
- hacker video
- SQL Server的日期选项
- 无插件在Eclipse中利用Resin调试和开发WEB应用程序
- Ogre 圆形水面的实现