ArcEngine添加指北针、比例尺、图例(注意UID值)
来源:互联网 发布:自己画装修设计图软件 编辑:程序博客网 时间:2024/06/05 10:23
指北针
- public void AddNorthArrow(IPageLayout pageLayout)
- {
- IGraphicsContainer container = pageLayout as IGraphicsContainer;
- IActiveView activeView = pageLayout as IActiveView;
- // 获得MapFrame
- IFrameElement frameElement = container.FindFrame(activeView.FocusMap);
- IMapFrame mapFrame = frameElement as IMapFrame;
- //根据MapSurround的uid,创建相应的MapSurroundFrame和MapSurround
- UID uid = new UIDClass();
- uid.Value = "esriCarto.MarkerNorthArrow";
- IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(uid, null);
- //设置MapSurroundFrame中指北针的点符号
- IMapSurround mapSurround = mapSurroundFrame.MapSurround;
- IMarkerNorthArrow markerNorthArrow = mapSurround as IMarkerNorthArrow;
- IMarkerSymbol markerSymbol = markerNorthArrow.MarkerSymbol;
- markerSymbol.Size = 18;
- markerNorthArrow.MarkerSymbol = markerSymbol;
- //QI,确定mapSurroundFrame的位置
- IElement element = mapSurroundFrame as IElement;
- IEnvelope envelope = new EnvelopeClass();
- envelope.PutCoords(0.2, 0.2, 5, 5);
- element.Geometry = envelope;
- //使用IGraphicsContainer接口添加显示
- container.AddElement(element, 0);
- activeView.Refresh();
- }
比例尺
- public void AddScalebar(IPageLayout pageLayout)
- {
- IGraphicsContainer container = pageLayout as IGraphicsContainer;
- IActiveView activeView = pageLayout as IActiveView;
- // 获得MapFrame
- IFrameElement frameElement = container.FindFrame(activeView.FocusMap);
- IMapFrame mapFrame = frameElement as IMapFrame;
- //根据MapSurround的uid,创建相应的MapSurroundFrame和MapSurround
- UID uid = new UIDClass();
- uid.Value = "esriCarto.AlternatingScaleBar";
- IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(uid, null);
- //设置MapSurroundFrame中比例尺的样式
- IMapSurround mapSurround = mapSurroundFrame.MapSurround;
- IScaleBar markerScaleBar = ((IScaleBar)mapSurround);
- markerScaleBar.LabelPosition = esriVertPosEnum.esriBelow;
- markerScaleBar.UseMapSettings();
- //QI,确定mapSurroundFrame的位置
- IElement element = mapSurroundFrame as IElement;
- IEnvelope envelope = new EnvelopeClass();
- envelope.PutCoords(0.2, 0.2, 1, 2);
- element.Geometry = envelope;
- //使用IGraphicsContainer接口添加显示
- container.AddElement(element, 0);
- activeView.Refresh();
- }
图例
- private void AddLegend(IPageLayout pageLayout)
- {
- IActiveView pActiveView = pageLayout as IActiveView;
- IGraphicsContainer container = pageLayout as IGraphicsContainer;
- // 获得MapFrame
- IMapFrame mapFrame = container.FindFrame(pActiveView.FocusMap) as IMapFrame;
- //根据MapSurround的uid,创建相应的MapSurroundFrame和MapSurround
- UID uid = new UIDClass();
- uid.Value = "esriCarto.Legend";
- IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(uid, null);
- //设置图例的Title
- ILegend2 legend = mapSurroundFrame.MapSurround as ILegend2;
- legend.Title = "地图图例";
- ILegendFormat format = new LegendFormatClass();
- ITextSymbol symbol = new TextSymbolClass();
- symbol.Size = 4;
- format.TitleSymbol = symbol;
- legend.Format = format;
- //QI,确定mapSurroundFrame的位置
- IElement element = mapSurroundFrame as IElement;
- IEnvelope envelope = new EnvelopeClass();
- envelope.PutCoords(2, 2, 8, 8);
- element.Geometry = envelope;
- //使用IGraphicsContainer接口添加显示
- container.AddElement(element, 0);
- pActiveView.Refresh();
- }
指北针
- public void AddNorthArrow(IPageLayout pageLayout)
- {
- IGraphicsContainer container = pageLayout as IGraphicsContainer;
- IActiveView activeView = pageLayout as IActiveView;
- // 获得MapFrame
- IFrameElement frameElement = container.FindFrame(activeView.FocusMap);
- IMapFrame mapFrame = frameElement as IMapFrame;
- //根据MapSurround的uid,创建相应的MapSurroundFrame和MapSurround
- UID uid = new UIDClass();
- uid.Value = "esriCarto.MarkerNorthArrow";
- IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(uid, null);
- //设置MapSurroundFrame中指北针的点符号
- IMapSurround mapSurround = mapSurroundFrame.MapSurround;
- IMarkerNorthArrow markerNorthArrow = mapSurround as IMarkerNorthArrow;
- IMarkerSymbol markerSymbol = markerNorthArrow.MarkerSymbol;
- markerSymbol.Size = 18;
- markerNorthArrow.MarkerSymbol = markerSymbol;
- //QI,确定mapSurroundFrame的位置
- IElement element = mapSurroundFrame as IElement;
- IEnvelope envelope = new EnvelopeClass();
- envelope.PutCoords(0.2, 0.2, 5, 5);
- element.Geometry = envelope;
- //使用IGraphicsContainer接口添加显示
- container.AddElement(element, 0);
- activeView.Refresh();
- }
比例尺
- public void AddScalebar(IPageLayout pageLayout)
- {
- IGraphicsContainer container = pageLayout as IGraphicsContainer;
- IActiveView activeView = pageLayout as IActiveView;
- // 获得MapFrame
- IFrameElement frameElement = container.FindFrame(activeView.FocusMap);
- IMapFrame mapFrame = frameElement as IMapFrame;
- //根据MapSurround的uid,创建相应的MapSurroundFrame和MapSurround
- UID uid = new UIDClass();
- uid.Value = "esriCarto.AlternatingScaleBar";
- IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(uid, null);
- //设置MapSurroundFrame中比例尺的样式
- IMapSurround mapSurround = mapSurroundFrame.MapSurround;
- IScaleBar markerScaleBar = ((IScaleBar)mapSurround);
- markerScaleBar.LabelPosition = esriVertPosEnum.esriBelow;
- markerScaleBar.UseMapSettings();
- //QI,确定mapSurroundFrame的位置
- IElement element = mapSurroundFrame as IElement;
- IEnvelope envelope = new EnvelopeClass();
- envelope.PutCoords(0.2, 0.2, 1, 2);
- element.Geometry = envelope;
- //使用IGraphicsContainer接口添加显示
- container.AddElement(element, 0);
- activeView.Refresh();
- }
图例
- private void AddLegend(IPageLayout pageLayout)
- {
- IActiveView pActiveView = pageLayout as IActiveView;
- IGraphicsContainer container = pageLayout as IGraphicsContainer;
- // 获得MapFrame
- IMapFrame mapFrame = container.FindFrame(pActiveView.FocusMap) as IMapFrame;
- //根据MapSurround的uid,创建相应的MapSurroundFrame和MapSurround
- UID uid = new UIDClass();
- uid.Value = "esriCarto.Legend";
- IMapSurroundFrame mapSurroundFrame = mapFrame.CreateSurroundFrame(uid, null);
- //设置图例的Title
- ILegend2 legend = mapSurroundFrame.MapSurround as ILegend2;
- legend.Title = "地图图例";
- ILegendFormat format = new LegendFormatClass();
- ITextSymbol symbol = new TextSymbolClass();
- symbol.Size = 4;
- format.TitleSymbol = symbol;
- legend.Format = format;
- //QI,确定mapSurroundFrame的位置
- IElement element = mapSurroundFrame as IElement;
- IEnvelope envelope = new EnvelopeClass();
- envelope.PutCoords(2, 2, 8, 8);
- element.Geometry = envelope;
- //使用IGraphicsContainer接口添加显示
- container.AddElement(element, 0);
- pActiveView.Refresh();
- }
阅读全文
0 0
- ArcEngine添加指北针、比例尺、图例(注意UID值)
- AO+Java实现比例尺、指北针、图名、图例的添加(ArcGIS Add-in for Java)
- Arcgis pagelayout 实现添加图名,比例尺,指北针
- AE c# 添加比例尺和指北针
- ArcGIS Engine自定义工具类,实现添加图名,比例尺,指北针
- [ArcEngine地图制图系列]—添加比例尺
- [ArcEngine地图制图系列]—添加地图指北针
- [ArcEngine地图制图系列]—添加图例
- 实现在PageLayout控件中添加了图例、指北针或比例
- Delphi ArcEngine 创建比例尺
- ArcEngine 图例C#源码:
- ArcEngine中设置添加图层的图例显示为水平一行的样式的方法
- 磁场传感器(指北针)
- 给DotSpatial添加比例尺
- AE开发输出地图添加指北针
- ArcObjects:添加图例代码
- 添加图例和注解
- AE二次开发,通过代码向axPageLayout控件,插入图例和指北针的方法
- activity dialog生命周期
- svn-连接不上
- 大数据的技术生态比喻
- 最新用友T1-商贸宝批发零售普及版V13.0破解版,无替换
- 201612-2工资计算
- ArcEngine添加指北针、比例尺、图例(注意UID值)
- 最小生成树算法(下)——Kruskal(克鲁斯卡尔)算法
- 数组、List和ArrayList的区别
- 占位置的选项卡 + 点击哪个哪个显示颜色
- 自学七层模型
- IOS测试入门必看
- mybatis批量update(mysql)
- 链表中倒数第k个结点
- 01-Hello Vue.js