Example #1
0
        /// <summary>
        /// Create the correct control for this dataset
        /// </summary>
        /// <param name="oContainer"></param>
        /// <returns></returns>
        private DownloadOptions CreateUserControl(Dapple.LayerGeneration.LayerBuilder oBuilder)
        {
            if (!WorldWind.GeographicBoundingBox.FromQuad(MainForm.WorldWindowSingleton.CurrentAreaOfInterest).Intersects(oBuilder.Extents))
            {
                return(new Disabled("This data layer cannot be " + GetExtractionVerb(oBuilder) + "ed. View the data layer extents within the currently viewed area and try again."));
            }

            DownloadOptions oControl = null;

            if (oBuilder is Dapple.LayerGeneration.DAPQuadLayerBuilder)
            {
                Dapple.LayerGeneration.DAPQuadLayerBuilder oDAPbuilder = (Dapple.LayerGeneration.DAPQuadLayerBuilder)oBuilder;

                double dummy1 = 0, dummy2 = 0, dummy3 = 0, dummy4 = 0;
                if (MainForm.MontajInterface.GetExtents(oDAPbuilder.ServerURL, oDAPbuilder.DatasetName, out dummy1, out dummy2, out dummy3, out dummy4) == false)
                {
                    return(new Disabled("This data layer will not be extracted because its metadata could not be accessed.  This usually indicates that you do not have the required permissions to access it."));
                }

                if (oDAPbuilder.IsFromPersonalDapServer)
                {
                    if (MainForm.Client == Options.Client.ClientType.ArcMAP &&
                        oDAPbuilder.DAPType.Equals("spf", StringComparison.OrdinalIgnoreCase) &&
                        oDAPbuilder.LocalFilename.EndsWith("(TAB)", StringComparison.OrdinalIgnoreCase))
                    {
                        return(new Disabled("This data layer will not be opened because TAB files are not supported in ArcMap."));
                    }

                    oControl = new PersonalDataset(oDAPbuilder);
                    oControl.ErrorProvider = cErrorProvider;
                    return(oControl);
                }

                if (oDAPbuilder.DAPType.ToLower() == "map")
                {
                    oControl = new HyperMAP(oDAPbuilder);
                }
                else if (oDAPbuilder.DAPType.ToLower() == "grid")
                {
                    oControl = new Grid(oDAPbuilder);
                }
                else if (oDAPbuilder.DAPType.ToLower() == "picture")
                {
                    oControl = new Picture(oDAPbuilder);
                }
                else if (oDAPbuilder.DAPType.ToLower() == "point")
                {
                    oControl = new HyperXYZ(oDAPbuilder);
                }
                else if (oDAPbuilder.DAPType.ToLower() == "database")
                {
                    oControl = new Database(oDAPbuilder);
                }
                else if (oDAPbuilder.DAPType.ToLower() == "document")
                {
                    oControl = new Document(oDAPbuilder);
                }
                else if (oDAPbuilder.DAPType.ToLower() == "spf")
                {
                    oControl = new GIS(oDAPbuilder);
                }
                else if (oDAPbuilder.DAPType.ToLower() == "generic")
                {
                    if (MainForm.Client != Options.Client.ClientType.MapInfo)
                    {
                        oControl = new Generic(oDAPbuilder);
                    }
                    else
                    {
                        oControl = new Disabled("This data layer will not be extracted as acQuire connections are not a supported format in MapInfo.");
                    }
                }
                else if (oDAPbuilder.DAPType.ToLower() == "voxel")
                {
                    if (MainForm.Client != Options.Client.ClientType.MapInfo)
                    {
                        oControl = new Voxel(oDAPbuilder);
                    }
                    else
                    {
                        oControl = new Disabled("This data layer will not be extracted as voxel is not a supported format in MapInfo.");
                    }
                }
                else if (oDAPbuilder.DAPType.ToLower() == "arcgis")
                {
                    if (MainForm.Client != Options.Client.ClientType.MapInfo)
                    {
                        oControl = new ArcGIS(oDAPbuilder);
                    }
                    else
                    {
                        oControl = new Disabled("This data layer will not be extracted as LYR is not a supported format in MapInfo.");
                    }
                }
                else if (oDAPbuilder.DAPType.ToLower() == "imageserver")
                {
                    oControl = new PictureWithoutResolution(oDAPbuilder);
                }
                else if (oDAPbuilder.DAPType.ToLower() == "picturesection")
                {
                    oControl = new SectionPicture(oDAPbuilder);
                }
                else if (oDAPbuilder.DAPType.ToLower() == "gridsection")
                {
                    oControl = new SectionGrid(oDAPbuilder);
                }
            }
            else if (oBuilder is KML.KMLLayerBuilder)
            {
                oControl = new Disabled("This data layer will not be extracted as KML extraction is not currently supported.");
            }
            else
            {
                oControl = new PictureWithoutResolution(oBuilder);
            }

            if (oControl != null)
            {
                oControl.ErrorProvider = cErrorProvider;
            }
            return(oControl);
        }