ArcGIS Pro SDK 布局
布局
布局项目项
参考布局项目项及其关联布局
1 | //Reference layout project items and their associated layout. |
在新视图中打开布局项目项
1 | //Open a layout project item in a new view. |
激活已打开的布局视图
1 | //Activate an already open layout view. |
引用活动布局视图
1 | //Reference the active layout view. |
将 pagx 导入到项目中
1 | //Import a pagx into a project. |
删除布局项目项
1 | //Remove a layout project item. |
创建新的基本布局并将其打开
1 | //Create a new, basic layout and open it. |
使用修改后的 CIM 创建新布局并将其打开
1 | //Create a new layout using a modified CIM and open it. |
更改布局页面大小
1 | //Change the layout page size. |
ProSnippet Group CIM Graphics and GraphicFactory
创建圆形图形
1 | //Must be on QueuedTask.Run(() => { ... |
创建圆形文本图形
1 | //Must be on QueuedTask.Run(() => { ... |
创建贝塞尔图形
1 | //Must be on QueuedTask.Run(() => { ... |
创建图例图面图形
1 | //Must be on QueuedTask.Run(() => { ... |
创建箭头图形
1 | //Must be on QueuedTask.Run(() => { ... |
创建图片图形
1 | //Must be on QueuedTask.Run(() => { ... |
创建布局图形元素
创建椭圆图形元素
1 | //Must be on QueuedTask.Run(() => { ... |
创建套索线,手绘图形元素
1 | //Must be on QueuedTask.Run(() => { ... |
创建套索多边形,手绘元素
1 | //Must be on QueuedTask.Run(() => { ... |
创建线元素
1 | //Must be on QueuedTask.Run(() => { ... |
创建点元素
1 | //Must be on QueuedTask.Run(() => { ... |
创建多边形元素
1 | //Must be on QueuedTask.Run(() => { ... |
创建矩形元素
1 | //Must be on QueuedTask.Run(() => { ... |
创建贝塞尔曲线元素
1 | //Must be on QueuedTask.Run(() => { ... |
创建图形元素
1 | //Must be on QueuedTask.Run(() => { ... |
使用 CIMG 创建图形元素
1 | //on the QueuedTask |
使用 CIMSymbol 创建图形元素
1 | //Must be on QueuedTask.Run(() => { ... |
批量元素创建
1 | //Must be on QueuedTask.Run(() => { ... |
使用 CIMG 创建元素
1 | //Must be on QueuedTask.Run(() => { ... |
使用符号系统创建点图形
1 | //Create a simple 2D point graphic and apply an existing point style item as the symbology. |
使用符号系统创建线图形
1 | //Create a simple 2D line graphic and apply an existing line |
使用简单符号系统创建矩形图形
1 | //Create a simple 2D rectangle graphic and apply simple fill and |
创建文本图形元素
创建点文本元素 1
1 | //Create a simple point text element and assign basic symbology and text settings. |
创建矩形段落文本元素 1
1 | //Create rectangle text with background and border symbology. |
创建动态点文本元素
1 | //Create a dynamic text element. |
创建点文本元素 2
1 | //Must be on QueuedTask.Run(() => { ... |
创建多边形段落文本元素
1 | //Must be on QueuedTask.Run(() => { ... |
创建矩形段落文本元素 2
1 | //Must be on QueuedTask.Run(() => { ... |
创建圆形文本元素
1 | //Must be on QueuedTask.Run(() => { ... |
创建贝塞尔文本元素
1 | //Must be on QueuedTask.Run(() => { ... |
创建椭圆文本元素
1 | //Must be on QueuedTask.Run(() => { ... |
创建预定义的形状和箭头
创建预定义的形状图形元素
1 | //Must be on QueuedTask.Run(() => { ... |
创建预定义的形状图形元素
1 | //Must be on QueuedTask.Run(() => { ... |
创建预定义的形状图形元素
1 | //Must be on QueuedTask.Run(() => { ... |
创建线箭头元素
1 | //Must be on QueuedTask.Run(() => { ... |
图片元素
使用 CIMSymbol 创建图片图形元素
1 | //Must be on QueuedTask.Run(() => { ... |
使用高级符号设置创建新的图片元素
1 | //Create a picture element and also set background and border symbology. |
创建地图框和环绕要素
创建地图框并设置照相机
1 | //Create a map frame and set its camera by zooming to the extent of an existing bookmark. |
创建图例
1 | //Create a legend for an associated map frame. |
从样式项创建比例尺
1 | //Create a scale bar using a style. |
从样式项 1 创建指北针
1 | //Create a north arrow using a style. |
创建表格框
1 | //Create a table frame. |
创建地图框 1
1 | //Must be on QueuedTask.Run(() => { ... |
创建地图框 2
1 | //Must be on QueuedTask.Run(() => { ... |
创建图例 2
1 | //Must be on QueuedTask.Run(() => { ... |
从样式项 2 创建指北针
1 | //Must be on QueuedTask.Run(() => { ... |
创建表格框
1 | //Must be on QueuedTask.Run(() => { ... |
创建比例尺
1 | //Must be on QueuedTask.Run(() => { ... |
创建比例线
1 | //Must be on QueuedTask.Run(() => { ... |
组元素
创建空组元素
1 | //Create an empty group element at the root level of the contents pane |
创建包含元素的组元素
1 | //Create a group with a list of elements at the root level of the contents pane. |
布局元素和选择
在布局上查找元素
1 | //Find an element on a layout. |
查找布局元素
1 | //on the QueuedTask |
更新元素属性
1 | //Update an element's properties. |
获取元素选择计数
1 | //Get element's selection count. |
设置元素选择
1 | //Set the active layout view's selection to include 2 rectangle elements. |
取消选择布局上的元素
1 | //Unselect one element. |
在布局视图中取消选择元素
1 | LayoutView layoutView = LayoutView.Active; |
清除布局视图中的选择
1 | //If the a layout view is active, clear its selection |
清除布局中的所选内容
1 | //Clear the layout selection. |
复制布局元素
1 | //on the QueuedTask |
删除布局元素
1 | //on the QueuedTask |
删除布局上的一个或多个元素
1 | //Delete an element or elements on a layout. |
缩放到元素
1 | LayoutView lytView = LayoutView.Active; |
设置指北针的晕圈属性
1 | //Set the CIM halo properties of a north arrow. |
对图形元素进行分组和排序
组图形元素
1 | //on the QueuedTask |
取消组合图形元素
1 | var selectedElements = layout.GetSelectedElements().ToList(); |
组元素的父级
1 | //check the parent |
组元素中的子元素
1 | // Nested groups within ArcGIS.Desktop.Layouts.GroupElement are not preserved. |
排序:向后发送和向前发送
1 | //On the QueuedTask |
获取 Z 顺序
1 | var selElementsZOrder = layout.GetSelectedElements(); |
更新布局元素
更新文本元素属性
1 | //Update text element properties for an existing text element. |
更新图片元素
1 | //Update a picture element. |
将背景颜色应用于地图框
1 | //Apply a background color to the map frame element using the CIM. |
更新地图整饰
1 | //Update a map surround. |
锁定元素
1 | // The Locked property is displayed in the TOC as a lock symbol next |
更新元素透明度
1 | //Update an element's transparency using the CIM. |
克隆元素
1 | //Clone a layout graphic element and apply an offset. |
布局元数据
布局元数据
1 | //var layout = ...; |
布局地图框
更改与地图框关联的地图
1 | //Change the map associated with a map frame |
更改地图框照相机设置
1 | //Change a map frame's camera settings. |
将地图框缩放到单个图层的范围
1 | //Zoom map frame to the extent of a single layer. |
将地图框范围更改为多个图层中的所选要素
1 | //Change the extent of a map frame to the selected features multiple layers. |
将地图框范围更改为具有 15% 缓冲区的单个要素
1 | //Change map frame extent to single feature with 10 percent buffer |
将页面坐标中的点转换为地图坐标中的点。
1 | //On the QueuedTask |
将地图坐标中的点转换为页面坐标中的点
1 | internal class GetMapCoordinates : MapTool |
布局图系列
修改现有地图系列
1 | //Modify the currently active map series and changes its sort field and page number field. |
创建新的空间地图系列
1 | // This example create a new spatial map series and then applies it to the active layout. This will automatically |
布局导出
将布局导出为 PDF
1 | //Export a single page layout to PDF. |
将地图框导出为 JPG
1 | //Export a map frame to JPG. |
将与地图框关联的地图视图导出到 BMP
1 | //Export the map view associated with a map frame to BMP. |
将地图系列导出为单个 PDF
1 | //Export a map series with multiple pages to a single PDF. |
将地图系列导出到单个 TIFF 文件
1 | //Export each page of a map series to an individual TIFF file. |
布局选项
获取布局选项
1 | var lastToolActive = ApplicationOptions.LayoutOptions.KeepLastToolActive; |
设置布局选项
1 | //keep graphic element insert tool active |
文本和图形元素选项
获取所有可用字体
1 | //Note: see also SymbolFactory.Instance.GetAvailableFonts() which returns the |
获取文本和图形元素选项
1 | QueuedTask.Run(() => |
设置文本和图形元素选项
1 | QueuedTask.Run(() => |
MapFrame_Display_Constraints
设置自动相机无
1 | var layout = LayoutView.Active.Layout; |
设置自动相机固定范围
1 | var layout = LayoutView.Active.Layout; |
设置自动相机固定中心
1 | var layout = LayoutView.Active.Layout; |
设置自动相机固定居中和缩放
1 | var layout = LayoutView.Active.Layout; |
设置自动相机固定比例
1 | var layout = LayoutView.Active.Layout; |
设置自动照相机链接范围
1 | var layout = LayoutView.Active.Layout; |
设置自动相机链接中心
1 | var layout = LayoutView.Active.Layout; |
设置自动相机链接中心和缩放
1 | var layout = LayoutView.Active.Layout; |
设置自动相机链接缩放
1 | var layout = LayoutView.Active.Layout; |
设置自动相机链接地图系列形状
1 | var layout = LayoutView.Active.Layout; |
设置自动相机链接地图系列中心
1 | var layout = LayoutView.Active.Layout; |
;
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 WineMonk!
评论