转自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); }

ArcGIS Engine 线段绘制的更多相关文章

  1. ArcGIS Engine 中的绘制与编辑

    1.线段绘制 基本步骤 构建形状 1. 创建 IPoint IPoint m_Point = new PointClass(); m_Point.PutCoords(x, y); 2. 创建 IPoi ...

  2. 基于Arcgis Engine 10.2(C#)+PostgreSQL 11(Postgis 3)+pgRouting 3.0实现使用数据库进行路径规划

    前言:最近在(被迫)使用ArcGIS Engine10.2(.NET平台)进行二次开发(桌面应用),因为想做一个最短路径查询的功能,而arcgis的网络分析又比较麻烦,于是想到了使用Postgis.但 ...

  3. ArcGIS Engine开发之图形查询

    图形查询是以用户通过鼠标操作生成的图形几何体为输入条件进行查询的查询,其查询结果为该几何体空间范围内的所有要素.常用的查询方式包括点选.线选.多边形选择.圆形选择和矩形选择等. 相关类与接口 图像查询 ...

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

    ArcGIS二次开发是当前gis领域的一项重要必不可少的技能.下面介绍它的基本功能 一.ArcGIS Engine功能 在使用之前首先安装和部署arcgis sdk,(在这里不在赘述相关知识)可以实现 ...

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

    原文:ArcGIS Engine开发之旅04---ARCGIS接口详细说明 ArcGIS接口详细说明... 1 1.      IField接口(esriGeoDatabase)... 2 2.    ...

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

    原文:ArcGIS Engine开发之旅03--ArcGIS Engine中的控件 制图控件,如MapControl.PageLayoutControl,其中MapControl控件主要用于地理数据的 ...

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

    原文:ArcGIS Engine开发之旅02--ArcGIS Engine中的类库 System类库 System类库是ArcGIS体系结构中最底层的类库.System类库包含给构成ArcGIS的其他 ...

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

    Dixon 原文  用ArcGIS Engine.VS .NET和Windows控件开发GIS应用     此过程说明适合那些使用.NET建立和部署应用的开发者,它描述了使用ArcGIS控件建立和部署 ...

  9. ArcGIS Engine 捕捉

    原文 ArcGIS Engine 捕捉 bool bCreateElement = true; ;//时间间隔 ;//初始值 IElement m_element = null; //界面绘制点元素 ...

随机推荐

  1. 大型网站架构之JAVA中间件

    中间件就是在大型网站中,帮助各子模块间实现互相访问,消息共享或统一访问等功能的软件产品.常见的有: 远程服务框架中间件:主要解决各子模块之间互相访问的问题. 消息队列中间件:主要解决各子模之间消息共享 ...

  2. hdoj--5053--the Sum of Cube(水)

    the Sum of Cube Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Tot ...

  3. Codefroces 852 G. Bathroom terminal

    G. Bathroom terminal Smith wakes up at the side of a dirty, disused bathroom, his ankle chained to p ...

  4. vmware-images

    https://virtualboxes.org/images/centos/ https://www.osboxes.org/vmware-images/

  5. Mark Compact GC (Part two :Two-Finger)

    目录 Two-Finger算法 前提 概要 步骤一:移动对象 步骤二:更新指针 优缺点 表格算法 概要 步骤一:移动对象群 和 构筑间隙表格 移动对象群 构筑间隙表格 步骤二:更新指针 优缺点 Two ...

  6. 在OEL 5.4 32bit上使用yum install命令遇到的问题

    在OEL 5.4 32bit上使用yum install命令遇到的问题 [root@localhost yum.repos.d]# yum install elfutils-libelf-devel- ...

  7. 【shell学习】经常使用条件推断-字符,数字,文件

    IF 推断 之前也写过简单的shell脚本,也不是转职运维.和系统相关的工作比較少.所以不怎么熟练. 近期因为系统总是出现各种乱七八糟的问题,也没有人来协助.仅仅好自己写shell脚本了,都是些基础的 ...

  8. android 动画xml属性具体解释

    /** * 作者:crazyandcoder * 联系: * QQ : 275137657 * email: lijiwork@sina.com * 转载请注明出处! */ android 动画属性具 ...

  9. Android学习笔记(23):列表项的容器—AdapterView的子类们

    AdapterView的子类的子类ListView.GridView.Spinner.Gallery.AdapterViewFlipper和StackView都是作为容器使用,Adapter负责提供各 ...

  10. OpenCASCADE 参数曲面面积

    OpenCASCADE 参数曲面面积 eryar@163.com Abstract. 本文介绍了参数曲面的第一基本公式,并应用曲面的第一基本公式,结合OpenCASCADE中计算多重积分的类,对任意参 ...