arcgis engine - 添加图例,指北针.
esri帮助提供了使用比例尺的方法: Working with map surrounds
主要代码为:
public void AddMapSurround(IPageLayout pageLayout, IActiveView activeView)
{
IMap map = activeView.FocusMap;
IGraphicsContainer graphicsContainer = pageLayout as IGraphicsContainer;
IFrameElement frameElement = graphicsContainer.FindFrame(map);
IMapFrame mapFrame = (IMapFrame)frameElement;
IMapSurroundFrame mapSurroundFrame = new MapSurroundFrameClass();
UID elementUID = new UIDClass(); //The value determines the type of MapSurroundFrame being added.
elementUID.Value = "esriCarto.Legend"; //The CreateSurroundFrame method takes the UID of the element and an optional style.
mapSurroundFrame = mapFrame.CreateSurroundFrame(elementUID, null);
mapSurroundFrame.MapSurround.Name = "Legend"; //Cast the MapSurroundFrame as an element so it can be inserted into the page layout.
IElement doc_Element = mapSurroundFrame as IElement;
IElement mainMap_Element = mapFrame as IElement;
IGeometry geometry = mainMap_Element.Geometry;
IEnvelope mainMap_Envelope = geometry.Envelope;
IEnvelope envelope = new EnvelopeClass();
double xMin = mainMap_Envelope.XMax + 1.5;
double yMin = mainMap_Envelope.YMin + 1.5;
double xMax = mainMap_Envelope.XMax - 1.5;
double yMax = mainMap_Envelope.YMax - 1.5;
envelope.PutCoords(xMin, yMin, xMax, yMax); doc_Element.Geometry = envelope as IGeometry;
doc_Element.Activate(activeView.ScreenDisplay);
graphicsContainer.AddElement(doc_Element, 0); activeView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
}
在实现地图同步后,分别获得IMap和IPageLayout对象,并调用之即可,如
//mapDoc.get_Map(0)
IMap map;
//map = map_Big.ActiveView as IMap;
IPageLayout pageLayout = pageLayoutCtrl.ActiveView as IPageLayout;
AddMapSurround(pageLayout, map_Big.ActiveView);
esri也提供使用指北针的方法,主要方法为:
public void AddNorthArrow(ESRI.ArcGIS.Carto.IPageLayout pageLayout, ESRI.ArcGIS.Carto.IMap map)
{ if(pageLayout == null || map == null)
{
return;
}
ESRI.ArcGIS.Geometry.IEnvelope envelope = new ESRI.ArcGIS.Geometry.EnvelopeClass();
envelope.PutCoords(0.2, 0.2, 5, 5); // Specify the location and size of the north arrow ESRI.ArcGIS.esriSystem.IUID uid = new ESRI.ArcGIS.esriSystem.UIDClass();
uid.Value = "esriCarto.MarkerNorthArrow"; // Create a Surround. Set the geometry of the MapSurroundFrame to give it a location
// Activate it and add it to the PageLayout's graphics container
ESRI.ArcGIS.Carto.IGraphicsContainer graphicsContainer = pageLayout as ESRI.ArcGIS.Carto.IGraphicsContainer; // Dynamic Cast
ESRI.ArcGIS.Carto.IActiveView activeView = pageLayout as ESRI.ArcGIS.Carto.IActiveView; // Dynamic Cast
ESRI.ArcGIS.Carto.IFrameElement frameElement = graphicsContainer.FindFrame(map);
ESRI.ArcGIS.Carto.IMapFrame mapFrame = frameElement as ESRI.ArcGIS.Carto.IMapFrame; // Dynamic Cast
ESRI.ArcGIS.Carto.IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(uid as ESRI.ArcGIS.esriSystem.UID, null); // Dynamic Cast
ESRI.ArcGIS.Carto.IElement element = mapSurroundFrame as ESRI.ArcGIS.Carto.IElement; // Dynamic Cast
element.Geometry = envelope;
element.Activate(activeView.ScreenDisplay);
graphicsContainer.AddElement(element, 0);
ESRI.ArcGIS.Carto.IMapSurround mapSurround = mapSurroundFrame.MapSurround; // Change out the default north arrow
ESRI.ArcGIS.Carto.IMarkerNorthArrow markerNorthArrow = mapSurround as ESRI.ArcGIS.Carto.IMarkerNorthArrow; // Dynamic Cast
ESRI.ArcGIS.Display.IMarkerSymbol markerSymbol = markerNorthArrow.MarkerSymbol;
ESRI.ArcGIS.Display.ICharacterMarkerSymbol characterMarkerSymbol = markerSymbol as ESRI.ArcGIS.Display.ICharacterMarkerSymbol; // Dynamic Cast
characterMarkerSymbol.CharacterIndex = 200; // change the symbol for the North Arrow
markerNorthArrow.MarkerSymbol = characterMarkerSymbol;
}
ref: http://blog.csdn.net/freeWayWalker/article/details/25633859
esri: http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#//00490000004w000000
arcgis engine - 添加图例,指北针.的更多相关文章
- ArcGIS Engine添加地图元素的实现
在ArcGIS中,我们使用的制图控件除了MapControl之外,还有PageLayoutControl,用于页面布局和制图,生成一幅成品地图. PageLayoutControl 封装了PageLa ...
- Arcgis Engine 添加一个Symbol符号样式步骤
public static void DrawPictureMarkerSymbol(IGlobe globe, String layerName) { //添加一个图层 ESRI.ArcGIS.Ca ...
- ArcGIS Engine 添加SDE数据库
public void AddSDELayer(bool ChkSdeLinkModle){ //定义一个属性 IPropertySet propset = new PropertySetCla ...
- [转] ArcGIS engine中气泡标注的添加、修改
小生 原文 ArcGIS engine中气泡标注的添加.修改! 你微微地笑着,不同我说什么话.而我觉得,为了这个,我已等待得久了. ...
- 《ArcGIS Engine+C#实例开发教程》第六讲 右键菜单添加与实现
原文:<ArcGIS Engine+C#实例开发教程>第六讲 右键菜单添加与实现 摘要:在这一讲中,大家将实现TOCControl控件和主地图控件的右键菜单.在AE开发中,右键菜单有两种实 ...
- 《ArcGIS Engine+C#实例开发教程》第四讲 状态栏信息的添加与实现
原文:<ArcGIS Engine+C#实例开发教程>第四讲 状态栏信息的添加与实现 摘要:在上一讲中,我们完成了 MapControl 和PageLayoutControl两种视图的同步 ...
- 《ArcGIS Engine+C#实例开发教程》第二讲 菜单的添加及其实现
原文:<ArcGIS Engine+C#实例开发教程>第二讲 菜单的添加及其实现 摘要:在上一讲中,我们实现了应用程序基本框架,其中有个小错误,在此先跟大家说明下.在“属性”选项卡中,我们 ...
- ArcGIS Engine效率探究——要素的添加和删除、属性的读取和更新
ArcGIS Engine效率探究——要素的添加和删除.属性的读取和更新 来自:http://blog.csdn.net/freewaywalker/article/details/23703863 ...
- ArcGIS Engine中添加点、线、面元素
转自原文 ArcGIS Engine中添加点.线.面元素 此种方式为IElement的方式在axMapControl的GraphicsContainer中好绘制图形. //画点 IPoint pt = ...
随机推荐
- pcDuino无显示器刷机与使用
准备工作: pcduino : 点此购买 一个可用的并且启用了DHCP的有线路由器. 连接pcduino与路由器的网线一根. 至少1张4G microSD卡,如果内存卡不大,可以用内存卡刷内核,用u盘 ...
- Hadoop RCFile存储格式详解(源码分析、代码示例)
RCFile RCFile全称Record Columnar File,列式记录文件,是一种类似于SequenceFile的键值对(Key/Value Pairs)数据文件. 关键词:Reco ...
- linux 以root用户登录ftp
ftp默认禁止以root用户登录. 可以修改 /etc/ftpusers 文件,把root注释掉,即可以root用户登录ftp
- loadrunner调用plink,远程linux执行shell命令
loadrunner调用plink,远程linux执行shell命令 脚本: Action() { char* cmd; cmd = lr_eval_string("C:\\\&qu ...
- ARM学习笔记13——LED驱动程序设计
首先我们要根据开发板原理图得到控制LED灯的引脚是哪个,我们现在以LED1为例,我们已经知道LED1由S5PV210的GPC1_3控制,因此我们按如下步骤进行: 第一步是配制S5PV210的GPC1_ ...
- 转载:Python中的new style class机制实现
1.Python中的对象模型python中所有东西都是对象 class对象:表示Python内置的类型和定义的类型instance对象(实例对象):表示由class对象创建的实例 1.1 对象间的关系 ...
- Javascript之<script>标签
把javascript代码插入到HTML页面中需要使用<script>标签,使用这个元素可以使javascript和html标记混合在一个页面中,也可以引入外部的javascript文件. ...
- JavaScript实现拖拽预览,AJAX小文件上传
本地上传,提前预览(图片,视频) 1.html中div标签预览显示,button标签触发上传事件. <div id="drop_area" style="bord ...
- 【转】Cannot change version of project facet Dynamic Web Module to 3.1 (Eclipse Maven唯一解决方案)
If you want to use version 3.1 you need to use the following schema: http://xmlns.jcp.org/xml/ns/jav ...
- 01 if
if - else if语句是一种控制语句,执行一代码块,如果一个表达式计算为true if (expression) statement1 else statement2 如 ...