ArcGIS Pro二次开发打开对话框

ArcGIS Pro二次开发打开对话框

 

在ArcGIS Pro的二次开发中,很多时候需要加载或者保存特定格式的数据库,如选择FileGDB中的数据进行加载、选择.sde数据库中的文件进行加载、加载支持的栅格数据等等,很多时候需要需要利用Windows自带的打开或者保存对话框,进行数据的过滤和保存,这样做起来比较繁琐,最新的ArcGIS Pro开发包针对GIS的各种格式,封装了专门的打开和保存的对话框,如下

ArcGIS.Desktop.Catalog.OpenItemDialog

       ArcGIS.Desktop.Catalog.SaveItemDialog

在线的帮助地址为https://pro.arcgis.com/en/pro-app/sdk/api-reference/#topic8992.html

和https://pro.arcgis.com/en/pro-app/sdk/api-reference/#topic9001.html

这两个对话框使用的使用方式简单

如打开对话框

            OpenItemDialog searchGdbDialog = new OpenItemDialog

            {

                Title = "Find GDB",

                InitialLocation = @"C:\Data",

                MultiSelect = false,

                Filter = ItemFilters.geodatabases

            };

 

            var ok = searchGdbDialog.ShowDialog();

            if (ok != true) return;

            var selectedItems = searchGdbDialog.Items;

            foreach (var selectedItem in selectedItems)

                GdbPath = selectedItem.Path;

这个例子是打开GDB的数据,通过Filter属性进行选择过滤,运行结果如下:

保存对话框如下

              // Create the log file and write the current Folder-Connection's to it

              SaveItemDialog saveDialog = new SaveItemDialog();

              saveDialog.Title = "Export the current selected map series item";

              saveDialog.OverwritePrompt = true;

              saveDialog.DefaultExt = "pdf";

 

              // If the save dialog was not dismissed, create the file

              if (saveDialog.ShowDialog() == true)

              {

                await QueuedTask.Run(() =>

                {

                  Layout layout = layoutItem.GetLayout();

                  if (layout == null)

                    return;

                  // Create PDF format with appropriate settings

                  PDFFormat PDF = new PDFFormat()

                  {

                    Resolution = 300,

                    OutputFileName = saveDialog.FilePath

                  };

                  if (PDF.ValidateOutputFilePath())

                  {

                    layout.Export(PDF);

                  }

                });

这个是保存当前地图为PDF的例子,运行结果如下

 

可以通过过滤属性Filter进行需要数据格式的过滤操作,支持过滤的格式基本上涵盖了所有GIS支持的格式,支持的格式如下:

Name

Description

annotation

Supports browsing for annotation feature classes  

cad

Supports browsing CAD datasets and the feature classes they contain  

composite_addToMap

Supports browsing for items and datasets that can be added to a map. As a composite filter, the default filter allows you to browse for anything that is supported, but focused filters are also available to browse just for layers or geodatabase items, for example, that you want to add to a map.  

composite_addToStereoMap

Supports browsing for items and datasets that can be added to a stereo map. As a composite filter, the default filter allows you to browse for anything that is supported, but focused filters are also available to browse just for layers or geodatabase items, for example, that you want to add to a stereo map.  

composite_elevationSource

Supports browsing for web layers and datasets that can be used to define the elevation surface of a globe. As a composite filter, the default filter allows you to browse for anything that is supported, but focused filters are also available to browse just for images services, for example, that you want to define the ground.  

composite_maps_import

Supports browsing for maps and layouts that can be imported to a project. As a composite filter, the default filter allows you to browse for anything that is supported, but focused filters are also available to browse just for ArcGIS Pro map or layout files, for example, that you want to import.  

databases

Supports browsing all types of databases supported by ArcGIS Pro. Both database connections in a project and databases stored on a local or network computer can be browsed.  

default_addToMap

Supports browsing all items or datasets that can be added to a map. This is the default filter in the composite_addToMap filter.  

default_addToStereoMap

Supports browsing all items or datasets that can be added to a stereo map. This is the default filter in the composite_addToStereoMap filter.  

default_import

Supports browsing all items that can be imported to a project. This is the default filter in the composite_maps_import filter.  

dimensions

Supports browsing for dimension feature classes  

featureClasses_all

Supports browsing all types of feature classes  

featureDatasets_all

Supports browsing all types of feature datasets  

folders

Supports browsing folder connections in the project and folders on a local or network computer  

geodatabaseItems_all

Supports browsing all types of items stored in a geodatabase  

geodatabases

Supports browsing all types of geodatabases supported by ArcGIS Pro. Both database connections in a project and databases stored on a local or network computer can be browsed.  

kml

Supports browsing Keyhole Markup Language files  

layers_allFileTypes

Supports browsing layer files and layer packages available from the active portal and from a local or network computer  

locators_allTypes

Supports browsing all types of locators, including locator files and ArcGIS Server geocoding services  

maps_all

Supports browsing maps in the project and all types of maps stored on a local or network computer  

packages

Supports browsing all types of packages available from the active portal and stored on a local or network computer  

project_templates

Supports browsing project templates available from the active portal and from a local or network computer  

projects

Supports browsing projects and project packages available from the active portal and from a local or network computer  

rasters

Supports browsing all types of rasters, including mosaic datasets and file-based raster datasets  

services_addToMap

Supports browsing all types of web layers from the active portal and services from server connections in the project that can be added to maps  

services_addToStereoMap

Supports browsing all types of web layers from the active portal and services from server connections in the project that can be added to stereo maps  

services_all

Supports browsing all types of web layers from the active portal and services from server connections in the project that can be used in ArcGIS Pro  

services_feature

Supports browsing feature services from the active portal and services from server connections in the project that can be added to maps  

services_image

Supports browsing image services from the active portal and services from server connections in the project that can be added to maps  

services_map

Supports browsing map services from the active portal and services from server connections in the project that can be added to maps  

shapefiles

Supports browsing for shapefiles stored on a local or network computer  

styleFiles

Supports browsing styles accessed from the active portal or stored on a local or network computer  

tables_all

Supports browsing all types of tables  

taskFiles

Supports browsing for task files stored on a local or network computer  

textFiles

Supports browsing all types of text files  

tinDatasets

Supports browsing for TIN datasets stored on a local or network computer  

toolboxes

Supports browsing for all types of toolboxes  

tools

Supports browsing for tools stored in toolboxes  

videos

Support browsing for video files  

workspaces_all

Supports browsing for all types of workspaces, including folders, geodatabases, and feature datasets  

 

相关地址如下

https://pro.arcgis.com/en/pro-app/sdk/api-reference/#topic8982.html

 

 

 

 

 

 

 

  • 2
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
ArcGIS Pro二次开发是指使用ArcGIS Pro软件进行自定义功能开发的过程。对于初学者而言,开始二次开发可能感到无从入手,因为中文资料较少,官方文档对于英文不熟悉的人来说可能不太友好。 要开始ArcGIS Pro二次开发,你可以按照以下步骤进行操作: 1. 首先,以管理员身份运行Visual Studio 2019。如果没有安装Visual Studio 2019,你需要先下载并安装它。 2. 在Visual Studio中,右键项目名称,选择"添加",然后选择"新建项"。 3. 在"新建项"下拉菜单中,选择"ArcGIS",然后选择"ArcGIS Pro Add-ins",再选择"ArcGIS Pro按钮",最后点击"添加"。 4. 接下来,配置新项目。在Visual Studio中,点击"文件",选择"新建",然后选择"项目"。 5. 在"新建项目"对话框中,选择"C#"作为语言,选择"Windows"作为平台,然后选择"ArcGIS Pro SDK"。在项目类型中选择"ArcGIS Pro模块加载项",然后点击"下一步"。 6. 设置新项目的配置,然后点击"创建"。等待项目创建完成。 通过以上步骤,你就可以开始进行ArcGIS Pro二次开发了。你可以根据你的需求,使用C#编程语言进行开发,并且利用ArcGIS Pro SDK提供的功能来扩展ArcGIS Pro软件的功能。 希望这些步骤能够帮助你入门ArcGIS Pro二次开发。如果你遇到了其他问题或需要更多详细的指导,请随时提问。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* [【ArcGIS Pro二次开发】系列学习笔记,持续更新,记得收藏](https://blog.csdn.net/xcc34452366/article/details/129223703)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *2* *3* [ArcGIS Pro二次开发环境配置及项目创建示例](https://blog.csdn.net/wsywsy00/article/details/128550006)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值