[ArcEngine地图制图系列]—添加比例尺
2015-05-11 11:18
946 查看
private void AddScaleBar(IActiveView pActiveView, IEnvelope pEnv)
{
try
{
IGraphicsContainer pGraphicsContainer = pActiveView.GraphicsContainer;
IMapFrame pMapFrame = pGraphicsContainer.FindFrame(pActiveView.FocusMap) as IMapFrame;
IMapSurroundFrame pMapSurroundFrame = new MapSurroundFrameClass();
pMapSurroundFrame.MapFrame = pMapFrame;
IScaleBar pScaleBar = SymbolUtilty.GetItemFromServerStyle("Scale Bars", "Alternating Scale Bar 1").Item as IScaleBar;
//此处修改比例尺属性
pScaleBar.Units = esriUnits.esriMeters;
pScaleBar.UnitLabel = "米";
pScaleBar.Divisions = (short)3;
pScaleBar.Subdivisions = 1;
//IStyleGalleryItem pStyleGalleryItem = SymbolUtilty.GetItemFromServerStyle("Scale Bars", "Alternating Scale Bar 1");
pMapSurroundFrame.MapSurround = (IMapSurround)pScaleBar;
IElement pElement = axPageControl.FindElementByName("ScaleBar");
if (pElement != null)
{
pGraphicsContainer.DeleteElement(pElement); //删除已经存在的比例尺
}
IElementProperties pElePro = null;
pElement = (IElement)pMapSurroundFrame;
pElement.Geometry = (IGeometry)pEnv;
pElePro = pElement as IElementProperties;
pElePro.Name = "ScaleBar";
pGraphicsContainer.AddElement(pElement, 0);
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
}
}
{
try
{
IGraphicsContainer pGraphicsContainer = pActiveView.GraphicsContainer;
IMapFrame pMapFrame = pGraphicsContainer.FindFrame(pActiveView.FocusMap) as IMapFrame;
IMapSurroundFrame pMapSurroundFrame = new MapSurroundFrameClass();
pMapSurroundFrame.MapFrame = pMapFrame;
IScaleBar pScaleBar = SymbolUtilty.GetItemFromServerStyle("Scale Bars", "Alternating Scale Bar 1").Item as IScaleBar;
//此处修改比例尺属性
pScaleBar.Units = esriUnits.esriMeters;
pScaleBar.UnitLabel = "米";
pScaleBar.Divisions = (short)3;
pScaleBar.Subdivisions = 1;
//IStyleGalleryItem pStyleGalleryItem = SymbolUtilty.GetItemFromServerStyle("Scale Bars", "Alternating Scale Bar 1");
pMapSurroundFrame.MapSurround = (IMapSurround)pScaleBar;
IElement pElement = axPageControl.FindElementByName("ScaleBar");
if (pElement != null)
{
pGraphicsContainer.DeleteElement(pElement); //删除已经存在的比例尺
}
IElementProperties pElePro = null;
pElement = (IElement)pMapSurroundFrame;
pElement.Geometry = (IGeometry)pEnv;
pElePro = pElement as IElementProperties;
pElePro.Name = "ScaleBar";
pGraphicsContainer.AddElement(pElement, 0);
pActiveView.PartialRefresh(esriViewDrawPhase.esriViewGraphics, null, null);
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
}
}
相关文章推荐
- [ArcEngine地图制图系列]—添加地图指北针
- [ArcEngine地图制图系列]—添加比例文本
- [ArcEngine地图制图系列]—添加网格
- [ArcEngine地图制图系列]—添加地图标题
- 【控件】给地图添加一个简单的比例尺条
- 【地图整饰】ArcMap添加图框及ArcEngine实现
- ArcEngine添加指北针、比例尺、图例(注意UID值)
- supermap学习系列(七)——用户自己在地图上添加点、线、面标注
- arcengine加载模板时实现比例尺与地图的同步
- 【iOS百度地图系列_2】卫星图、交通图、热力图及在基本地图上添加覆盖物
- [AE] 地图整饰-添加地图框架元素(指北针、比例尺、图例、标题)
- ArcGIS制图技巧系列(3)—让地图更有立体感
- 【地图整饰】ArcMap添加地图标题及ArcEngine实现
- OpenLayers3基础教程之实现地图鹰眼以及地图比例尺的添加
- ArcEngine开发之导出地图(C#)
- Arcgis pagelayout 实现添加图名,比例尺,指北针
- ArcGIS Engine自定义工具类,实现添加图名,比例尺
- [转]Ultra Fractal教程系列15——学习基础技巧07——添加外着色
- 手把手教你实现百度基础地图+定位功能+设置中心点+添加Marker