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 = ...
随机推荐
- ETL构建数据仓库五步法
原文:http://huangy82.blog.163.com/blog/static/49069827200923034638409/ ETL构建企业级数据仓库五步法 在数据仓库构建中,ETL贯穿于 ...
- HDOJ/HDU 1022 Train Problem I(模拟栈)
Problem Description As the new term comes, the Ignatius Train Station is very busy nowadays. A lot o ...
- bzoj3224 Tyvj 1728 普通平衡树(名次树+处理相同)
3224: Tyvj 1728 普通平衡树 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 5354 Solved: 2196[Submit][Sta ...
- Mac下快捷键列表
主界面 command + tab 切换程序 command + ` 在程序内切换界面 command + w 关闭界面 command + q 关闭程序 command + option + esc ...
- lfs遇到的一些问题--准备阶段
本机宿主系统archlinux,lfs SVN-20130711,参考文档 1.在离开或重新进入当前工作环境 (比如 su 成为 root 或者其他用户) 时不要忘记检查 $LFS 是否设置好. ec ...
- Android游戏与应用开发最佳学习路线图
Android 游戏与应用开发最佳学习路线图 为了帮助大家更好的学习 Android,并快速入门特此我们为大家制定了以下学习路线图,希望能够帮助大家. 一.路线图概括: 二.具体需要掌握知识点: 三. ...
- Hadoop--Map/Reduce实现多表链接
MR实现多表连接的原理和单表连接时一样的,甚至比单表连接还要简单. 在map阶段只需要根据文件的名称区分左表还是右表.使用关联的字段作为key2. 在reduce中对values中的值分别存储到一个左 ...
- webapp 慎用setInterval、setTimeout
其实这片文章刚开始我啥也没写的,但也有20多的访问量,所以觉得大家还是比较关注这个问题,所以找机会写下. 问题的引出: 为什么我说的时webapp中慎用setInterval.setTimeout, ...
- C语言、Java的编译系统
Java是跨平台的. Java代码的编译是由Java语言的编译器来执行的,执行后生成的是.class文件,该文件是字节码文件. 然后交给虚拟机进行运行,虚拟机是在各个平台上可移植的.从而决定了Java ...
- datasorttable表格
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/stri ...