博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ArcGIS Engine 线段绘制
阅读量:7234 次
发布时间:2019-06-29

本文共 2260 字,大约阅读时间需要 7 分钟。

转自

 

基本步骤

构建形状

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);

-----------------------------------------------------------------------------------------------------------

其他方法

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
); 
 
}     

 

没有整理与归纳的知识,一文不值!高度概括与梳理的知识,才是自己真正的知识与技能。 永远不要让自己的自由、好奇、充满创造力的想法被现实的框架所束缚,让创造力自由成长吧! 多花时间,关心他(她)人,正如别人所关心你的。理想的腾飞与实现,没有别人的支持与帮助,是万万不能的。
    本文转自wenglabs博客园博客,原文链接:http://www.cnblogs.com/arxive/p/6816945.html
,如需转载请自行联系原作者
你可能感兴趣的文章
Mahout贝叶斯算法拓展篇3---分类无标签数据
查看>>
TCP/IP ---分层
查看>>
/dev/null简介
查看>>
uber优步提高成单率,轻松拿奖励!
查看>>
Redis源代码分析(三十五)--- redis.c服务端的实现分析(2)
查看>>
PV(访问量)、UV(独立访客)、IP(独立IP) (转)
查看>>
docker数据拷贝
查看>>
shiro realm 注解失败问题解决过程
查看>>
iOS 静态库,动态库与 Framework 浅析
查看>>
Java对ArrayList进行排序
查看>>
NumberFormat
查看>>
Spring WebSocket初探1 (Spring WebSocket入门教程)<转>
查看>>
每天一个linux命令(01):ifconfig命令
查看>>
vim打造简易C语言编辑器(在用2016.7.10)
查看>>
Response.Cookies 和 Request.Cookies
查看>>
Unity之定时调用
查看>>
[工具] 葡萄集
查看>>
I/O复用机制概述
查看>>
给JBoss种蛊分析
查看>>
winform按钮和子按钮
查看>>