Select to view content in your preferred language

How do you add Layers using the AE SDK Gallery template?

794
4
01-25-2011 06:55 AM
WayTody
Emerging Contributor
Hello
  I'm new to using AE and would like to add a list of layers using the Gallery template provide with Visual Studio (C#) SDK.   I'm looking for help on this from anyone willing to share their experience.

Thanks
0 Kudos
4 Replies
AndreiIvanov
Deactivated User
Hi,

this is very straight forward. You got excellent sample for Gallery class in SDK:

http://help.arcgis.com/en/arcgisexplorer/1500/sdk/componenthelp/index.html#//000300000rq1000000

on a click event you'd be connecting to service layer itself, sample you can find here:

http://help.arcgis.com/en/arcgisexplorer/1500/sdk/componenthelp/index.html#//000300000835000000
0 Kudos
WayTody
Emerging Contributor
Thanks for the reply.  Also will this option work instead for .lyr files?
http://help.arcgis.com/en/arcgisexplorer/1500/sdk/componenthelp/index.html#/PackageLayer_Class/00030...
0 Kudos
AndreiIvanov
Deactivated User
Waylon, it should work for pretty much everything: shapefile, raster, service layer, package layer, and etc. 

    public class Gallery : ESRI.ArcGISExplorer.Application.Gallery
    {

        public Gallery()
        {
            // Add some items to the gallery.
            this.Items.Add(new GalleryItem("package layer", null));
        }

        public override void OnClick(GalleryItem item)
        {
            // Work out which item was clicked.
            if (item.Caption.StartsWith("package"))
            {
                PackageLayer pkLayer = new PackageLayer("path to package layer");
                if (pkLayer.Connect())
                {
                    //Add the PackageLayer to the Map
                    ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.Map.ChildItems.Add(pkLayer);
                    ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay.ZoomTo(pkLayer);
                }
            }
        }
    }
0 Kudos
WayTody
Emerging Contributor
thanks.  I have 20 or so gallery items, is it possible to use only one if statement.  Possibly set a variable to represent the selected gallery item, if so how do you recommend I do this?
0 Kudos