ArcGIS Explorer Component Help |
MapItemCollection..::.Add<(Of <(T>)>) Method (IEnumerable<(Of <(T>)>)) |
MapItemCollection Class Example See Also |
Adds an enumerable set of MapItem objects to the end of the collection.
Namespace:
ESRI.ArcGISExplorer.MappingAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public void Add<T>( IEnumerable<T> items ) where T : MapItem |
Visual Basic (Declaration) |
---|
Public Sub Add(Of T As MapItem) ( _ items As IEnumerable(Of T) _ ) |
Parameters
- items
- Type: System.Collections.Generic..::.IEnumerable<(Of <(T>)>)
An enumerable set containing MapItem objects each of which represents a type of map content.
Type Parameters
- T
- A type of MapItem.
Remarks
The MapItem objects will be added after the last existing item in the collection. To add the items to the start of the collection use the AddFirst method.
Use this overload to add multiple MapItems objects to the collection in a single method call.
Examples
The code below demonstrates how to add multiple MapItems to the Map using a single method call.
CopyC#
{ //Get the MapDisplay MapDisplay mapDisplay = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay; //Open file geodatabase Geodatabase gdb = new Geodatabase(@"C:\Data\Forestry.gdb"); //Create Folder for phonemast data Folder phonefolder = new Folder("Phone Mast Information"); FeatureLayer mastsLayer = FeatureLayer.OpenFromTable(gdb.OpenTable("PHONEMASTS")); //Points phonefolder.ChildItems.Add(mastsLayer); phonefolder.ChildItems.Add(FeatureLayer.OpenFromTable(gdb.OpenTable("PROTECTED_AREAS"))); //Polygons //Create Folder for tree information Folder treesFolder = new Folder("Tree Stand Information"); treesFolder.ChildItems.Add(new Link("Forestry Commission", new Uri("http://www.forestry.gov.uk/"))); treesFolder.ChildItems.Add(FeatureLayer.OpenFromTable(gdb.OpenTable("STANDS"))); //Polygons treesFolder.ChildItems.Add(FeatureLayer.OpenFromTable(gdb.OpenTable("DISTRICT"))); //Polygons //Add the two Folders to a List List<MapItem> items = new List<MapItem>(); items.Add(treesFolder); items.Add(phonefolder); //Add both Folders to the MapItemCollection using a single method call mapDisplay.Map.ChildItems.Add(items); //Move the phone masts layer (points) to the top of the LayerOrderCollection to ensure //that it is drawn above all other layers. mapDisplay.Map.LayerDrawingOrder.MoveToTop(mastsLayer); }
CopyVB.NET
'Get the MapDisplay Dim mapDisp As MapDisplay = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay 'Open file geodatabase Dim gdb As Geodatabase = New Geodatabase("C:\Data\Forestry.gdb") 'Create Folder for phonemast data Dim phoneFolder As Folder = New Folder("Phone Mast Information") Dim mastsLayer As FeatureLayer = FeatureLayer.OpenFromTable(gdb.OpenTable("PHONEMASTS")) 'Points phoneFolder.ChildItems.Add(mastsLayer) phoneFolder.ChildItems.Add(FeatureLayer.OpenFromTable(gdb.OpenTable("PROTECTED_AREAS"))) 'Polygons 'Create Folder for tree information Dim treesFolder As Folder = New Folder("Tree Stand Information") treesFolder.ChildItems.Add(New Link("Forestry Commission", New Uri("http:'www.forestry.gov.uk/"))) treesFolder.ChildItems.Add(FeatureLayer.OpenFromTable(gdb.OpenTable("STANDS"))) 'Polygons treesFolder.ChildItems.Add(FeatureLayer.OpenFromTable(gdb.OpenTable("DISTRICT"))) 'Polygons 'Add the two Folders to a List Dim items As List(Of MapItem) = New List(Of MapItem) items.Add(treesFolder) items.Add(phoneFolder) 'Add both Folders to the MapItemCollection using a single method call mapDisp.Map.ChildItems.Add(items) 'Move the phone masts layer (points) to the top of the LayerOrderCollection to ensure 'that it is drawn above all other layers. mapDisp.Map.LayerDrawingOrder.MoveToTop(mastsLayer)