//ArcGIS Engine 线段绘制研究
//基本步骤
//构建形状
//创建 IPoint
IPoint m_Point = new PointClass();
m_Point.PutCoords(x, y);
//创建 IPointCollection
IPointCollection m_PointCollection = new PolylineClass();
m_PointCollection.AddPoint(m_Point, ref Type.Missing, ref Type.Missing);
//创建 IPolyline
IPolyline m_Polyline = new PolylineClass();
m_Polyline = m_PointCollection as IPolyline;
//创建 IElement
// Element 不能实例化,需要用其派生类实例化
IElement m_Element = m_SimpleLineSymbol as IElement;
m_Element.Geometry = m_Polyline;
//设置形状样式
//创建 ISimpleLineSymbol
ISimpleLineSymbol m_SimpleLineSymbol = new SimpleLineSymbolClass();
//创建 ILineElement
ILineElement m_LineElement = new LineElementClass();
m_LineElement.Symbol = m_SimpleLineSymbol;
//加载到地图
IMap m_Map = axMapControl1.Map;
IActiveView m_ActiveView = m_Map as IActiveView;
IGraphicsContainer m_Container = m_Map as IGraphicsContainer;
m_Container.AddElement(m_Element, 0);
m_Active.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
private void DrawLine()
{
ILineElement pLineElement;
IElement pLElement;
IPolyline pLine;
RgbColor pColor = new RgbColor();
pColor.Red = 0;
pColor.Green = 0;
pColor.Blue = 255;
ISimpleLineSymbol pSimpleLineSymbol = new SimpleLineSymbolClass();
pSimpleLineSymbol.Color = pColor;
pSimpleLineSymbol.Width = 5;
pLineElement = new LineElementClass();
pLineElement.Symbol = pSimpleLineSymbol;
pLElement = pLineElement as IElement;
IRubberBand pRubberBand;
pRubberBand = new RubberLineClass();
pLine = pRubberBand.TrackNew(axMapControl1.ActiveView.ScreenDisplay, null) as IPolyline;
pLElement.Geometry = pLine;
IGraphicsContainer pGraphicsContainer;
pGraphicsContainer = axMapControl1.ActiveView as IGraphicsContainer;//把地图的当前view作为图片的容器
pGraphicsContainer.AddElement(pLElement, 0);//把刚刚的element转到容器上
axMapControl1.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
}
专业从事基于C#,WinForm ,WPF,Silverlight,WCF以及MS Sql Server 2000/2005/2008/2012 Oracle 9i/10g/11g数据库系统的ERP,CRM,企业进销存等各种数据库管理系统开发。Asp.net,Asp.net mvc,Webservice,WCF, Webapi等服务程序开发。
基于Oracle MySQL MSSql postgresql各种数据库的管理系统数据同步服务。以及基于MapXtreme, Arcgis Engine ,以及基于Arcgis for silverlight/Javascript的WebGIS等相关的GIS系统二次开发。基于Windows 10 Mobile的移动端开发方案。针对各种系统的二次开发维护,并提供相关开发的技术性支持,如程序BUG解决,应用系统架构,技术难题攻克等相关技术服务。
联系方式: QQ :80163278(devgis) 邮箱:devgis@qq.com