标题: ARCGIS PRO SDK MapProjectItem 地图项目类 [打印本页] 作者: 涛声依旧在 时间: 2024-9-29 17:38 标题: ARCGIS PRO SDK MapProjectItem 地图项目类 一、获取工程中的所有地图
Dim projectMaps As IEnumerable(Of MapProjectItem) = Project.Current.GetItems(Of MapProjectItem)()
复制代码
二、从项目中删除地图
Dim mapProjItem = Project.Current.GetItems(Of MapProjectItem)().FirstOrDefault(Function(mpi) mpi.Name = "需删除的地图名称")
Await QueuedTask.Run(Sub()
Project.Current.RemoveItem(mapProjItem)
End Sub)
复制代码
三、遍历项目的所有 MapProjectItems
dim newMapItemsContainer as IEnumerable(of MapProjectItem) = project.Current.GetItems(of MapProjectItem)()
Await QueuedTask.Run(Sub()
for each mp in newMapItemsContainer
dim myMap as Map = mp.GetMap()
next
End Sub)
复制代码
四 获取特定的 MapProjectItem
Dim mapProjItem = Project.Current.GetItems(Of MapProjectItem)().FirstOrDefault(Function(mpi) mpi.Name = "指定的地图名称")
'或等价于
Dim mapProjItem = Project.Current.GetItems(Of MapProjectItem)().FirstOrDefault(Function(mpi) mpi.Name.Equals("指定的地图名称"))
复制代码
五、在工程中查找地图并将其打开
Dim pmap as map
Dim mpi As MapProjectItem = Project.Current.GetItems(Of MapProjectItem)().FirstOrDefault(Function(m) m.Name.Equals("需删除的地图名称", StringComparison.CurrentCultureIgnoreCase))