ArcGIS Engine 线段绘制

转自ArcGIS Engine 线段绘制研究

基本步骤

构建形状

1. 创建 IPoint
IPoint m_Point = new PointClass();
m_Point.PutCoords(x, y);

2. 创建 IPointCollection
IPointCollection m_PointCollection = new PolylineClass();
m_PointCollection.AddPoint(m_Point, ref Type.Missing, ref Type.Missing);

3. 创建 IPolyline
IPolyline m_Polyline = new PolylineClass();
m_Polyline = m_PointCollection as IPolyline;

4. 创建 IElement
// Element 不能实例化,需要用其派生类实例化
IElement m_Element = m_SimpleLineSymbol as IElement;
m_Element.Geometry = m_Polyline;

设置形状样式
1. 创建 ISimpleLineSymbol
ISimpleLineSymbol m_SimpleLineSymbol = new SimpleLineSymbolClass();

2. 创建 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);  

}
时间: 2024-08-02 05:59:23

ArcGIS Engine 线段绘制的相关文章

ArcGIS Engine 线段绘制研究

转自原文 ArcGIS Engine 线段绘制研究 基本步骤 构建形状 1. 创建 IPoint IPoint m_Point = new PointClass(); m_Point.PutCoords(x, y); 2. 创建 IPointCollection IPointCollection m_PointCollection = new PolylineClass(); m_PointCollection.AddPoint(m_Point, ref Type.Missing, ref Ty

利用ArcGIS Engine、VS .NET和Windows控件开发GIS应用

原文:利用ArcGIS Engine.VS .NET和Windows控件开发GIS应用 此过程说明适合那些使用.NET建立和部署应用的开发者,它描述了使用ArcGIS控件建立和部署应用的方法和步骤. 你可以在下面的目录下找到相应的样例程序: <安装目录>\DeveloperKit\Samples\Developer_Guide_Scenarios\ ArcGIS_Engine\Building_an_ArcGIS_Control_Application\Map_Viewer 注:ArcGIS样

ArcGIS Engine开发前基础知识(1)

ArcGIS二次开发是当前gis领域的一项重要必不可少的技能.下面介绍它的基本功能 一.ArcGIS Engine功能 在使用之前首先安装和部署arcgis sdk,(在这里不在赘述相关知识)可以实现的功能主要有地图的基本操作.信息查询.专题地图制作.数据编辑.网络分析.空间统计分析.三维分析等. 1.地图的基本操作 地图的基本操作主要包括加载矢量.栅格数据,浏览缩放地图,保存地图,在地图上显示文本注记,绘制点线面几何体等. 2.信息查询 信息查询主要通过矩形圆形或多边形来选中地图上的要素,或者

ArcGIS Engine 捕捉

原文 ArcGIS Engine 捕捉 bool bCreateElement = true; int internalTime = 5;//时间间隔 int snapTime = 10;//初始值 IElement m_element = null; //界面绘制点元素 IPoint currentPoint = new PointClass(); //当前鼠标点 IPoint snapPoint = null; //捕捉到的点 IMovePointFeedback pFeedback = n

ArcGIS Engine开发之旅02--ArcGIS Engine中的类库

原文 ArcGIS Engine开发之旅02--ArcGIS Engine中的类库 System类库 System类库是ArcGIS体系结构中最底层的类库.System类库包含给构成ArcGIS的其他类库提供服务的组件.System类库中定义了大量开发者可以实现的接口.AoInitializer对象就是在System类库中定义的,所有的开发者必须使用这个对象来初始化ArcGISEngine和解除ArcGIS Engine的初始化.开发者不能扩展这个类库,但可以通过实现这个类库中包含的接口来扩展A

ArcGIS Engine开发之旅04---ARCGIS接口详细说明

原文 ArcGIS Engine开发之旅04---ARCGIS接口详细说明 ArcGIS接口详细说明... 1 1.IField接口(esriGeoDatabase)... 2 2.IFieldEdit接口(esriGeoDatabase)... 2 3.IFields接口(esriGeoDatabase)... 2 4. IRow接口(esriGeoDatabase)... 3 5. ITable接口(esriGeoDatabase)... 3 6. IArea接口(esriGeometry)

ArcGIS Engine开发之旅03--ArcGIS Engine中的控件

原文 ArcGIS Engine开发之旅03--ArcGIS Engine中的控件 制图控件,如MapControl.PageLayoutControl,其中MapControl控件主要用于地理数据的显示和分析,PageLayoutControl用于生成一幅成品地图.MapControl封装了Map对象,而PageLayoutControl则封装了PageLayout对象.这两个控件都实现了IMxContents接口,因此不仅可以读取ArcMap创建的地图文档,而且可以将自身的地图内容写到一个新

ArcGIS Engine中的重点类库介绍

转自原文ArcGIS Engine中的重点类库介绍 System类库 System类库是ArcGIS体系结构中最底层的类库.System类库包含给构成ArcGIS的其他类库提供服务的组件.System类库中定义了大量开发者可以实现的接口.AoInitializer对象就是在System类库中定义的,所有的开发者必须使用这个对象来初始化ArcGISEngine和解除ArcGIS Engine的初始化.开发者不能扩展这个类库,但可以通过实现这个类库中包含的接口来扩展ArcGIS系统. SystemU

ArcGIS Engine能够做什么?

转自原文ArcGIS Engine能够做什么? ArcGIS Engine是一组跨平台的嵌入式ArcObjects,它是ArcGIS软件产品的底层组件,用来构建定制的GIS和桌面制图应用程序,或是向原有的应用程序增加新的功能.ArcGIS Engine应用程序可以是简单的地图浏览器,也可以是定制的GIS编辑和分析程序.通过 ArcGIS Engine 构建的应用,既可以以地图显示为中心,也可以不是,这一点非常重要.这一特性使 ArcGIS Engine特别适合于构建非GIS为中心的应用. 作为一