一、获取工程中的所有地图
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))
If mpi Is Nothing = False Then
pmap = mpi.GetMap()
End If
Await ProApp.Panes.CreateMapPaneAsync(pmap)