Example #1
0
        public void LoadData(IList ilist_0)
        {
            try
            {
                List <ILayer> list = new List <ILayer>();
                for (int i = 0; i < ilist_0.Count; i++)
                {
                    if (ilist_0[i] is IGxLayer)
                    {
                        list.Add((ilist_0[i] as IGxLayer).Layer);
                    }
                    else
                    {
                        IGxDataset gxDataset = ilist_0[i] as IGxDataset;
                        if (gxDataset != null)
                        {
                            IDataset dataset = gxDataset.Dataset;
                            if (dataset != null)
                            {
                                if (dataset.Type == esriDatasetType.esriDTFeatureClass)
                                {
                                    IFeatureClass featureClass = (IFeatureClass)dataset;
                                    IFeatureLayer featureLayer;
                                    if ((gxDataset as IGxObject).Category.IndexOf("CAD") != -1)
                                    {
                                        if (featureClass.FeatureType == esriFeatureType.esriFTCoverageAnnotation)
                                        {
                                            featureLayer = new CadAnnotationLayer() as IFeatureLayer;
                                        }
                                        else
                                        {
                                            featureLayer = new CadFeatureLayer() as IFeatureLayer;
                                        }
                                        featureLayer.FeatureClass = featureClass;
                                        featureLayer.Name         = featureClass.AliasName;
                                    }
                                    else if (featureClass.FeatureType == esriFeatureType.esriFTAnnotation)
                                    {
                                        featureLayer = new FDOGraphicsLayer() as IFeatureLayer;
                                        featureLayer.FeatureClass = featureClass;
                                        featureLayer.Name         = featureClass.AliasName;
                                    }
                                    else if (featureClass.FeatureType == esriFeatureType.esriFTDimension)
                                    {
                                        featureLayer = new DimensionLayer() as IFeatureLayer;
                                        featureLayer.FeatureClass = featureClass;
                                        featureLayer.Name         = featureClass.AliasName;
                                    }
                                    else
                                    {
                                        featureLayer = new FeatureLayer();
                                        featureLayer.FeatureClass = featureClass;
                                        featureLayer.Name         = featureClass.AliasName;
                                    }
                                    list.Add(featureLayer);
                                }
                                else if (dataset.Type == esriDatasetType.esriDTCadDrawing)
                                {
                                    if ((gxDataset as IGxObject).Category == "CAD绘图")
                                    {
                                        ICadLayer item = new CadLayer() as ICadLayer;
                                        item.CadDrawingDataset = gxDataset.Dataset as ICadDrawingDataset;
                                        item.Name = gxDataset.Dataset.Name;
                                        list.Add(item);
                                    }
                                    else
                                    {
                                        IEnumGxObject children = (gxDataset as IGxObjectContainer).Children;
                                        children.Reset();
                                        for (IGxDataset gxDataset2 = children.Next() as IGxDataset; gxDataset2 != null; gxDataset2 = (children.Next() as IGxDataset))
                                        {
                                            IFeatureClass featureClass = gxDataset2.Dataset as IFeatureClass;
                                            if (featureClass != null)
                                            {
                                                IFeatureLayer featureLayer;
                                                if (featureClass.FeatureType == esriFeatureType.esriFTAnnotation)
                                                {
                                                    featureLayer = new FDOGraphicsLayer() as IFeatureLayer;
                                                    featureLayer.FeatureClass = featureClass;
                                                    featureLayer.Name         = featureClass.AliasName;
                                                }
                                                else
                                                {
                                                    featureLayer = new CadFeatureLayer() as IFeatureLayer;
                                                    featureLayer.FeatureClass = featureClass;
                                                    featureLayer.Name         = featureClass.AliasName;
                                                }
                                                list.Add(featureLayer);
                                            }
                                        }
                                    }
                                }
                                else if (dataset.Type == esriDatasetType.esriDTFeatureDataset)
                                {
                                    IEnumDataset subsets = dataset.Subsets;
                                    subsets.Reset();
                                    for (IDataset dataset2 = subsets.Next(); dataset2 != null; dataset2 = subsets.Next())
                                    {
                                        if (dataset2.Type == esriDatasetType.esriDTFeatureClass)
                                        {
                                            IFeatureClass featureClass = dataset2 as IFeatureClass;
                                            if (featureClass.FeatureType == esriFeatureType.esriFTAnnotation)
                                            {
                                                IFeatureLayer item = new FDOGraphicsLayer() as IFeatureLayer;
                                                item.FeatureClass = featureClass;
                                                item.Name         = featureClass.AliasName;
                                                list.Add(item);
                                            }
                                            else
                                            {
                                                list.Add(new FeatureLayer
                                                {
                                                    FeatureClass = featureClass,
                                                    Name         = featureClass.AliasName
                                                });
                                            }
                                        }
                                        else if (dataset2.Type == esriDatasetType.esriDTTopology)
                                        {
                                            ITopologyLayer topologyLayer = new TopologyLayer() as ITopologyLayer;
                                            topologyLayer.Topology         = (dataset2 as ITopology);
                                            (topologyLayer as ILayer).Name = dataset2.Name;
                                            list.Add(topologyLayer as ILayer);
                                        }
                                    }
                                }
                                else if (dataset.Type == esriDatasetType.esriDTTopology)
                                {
                                    if (System.Windows.Forms.MessageBox.Show("是否将参加拓扑-" + dataset.Name + "-的所有要素添加到地图中", "添加拓扑层", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Asterisk) == System.Windows.Forms.DialogResult.Yes)
                                    {
                                        IEnumFeatureClass classes = (dataset as IFeatureClassContainer).Classes;
                                        classes.Reset();
                                        for (IFeatureClass featureClass2 = classes.Next(); featureClass2 != null; featureClass2 = classes.Next())
                                        {
                                            list.Add(new FeatureLayer
                                            {
                                                FeatureClass = featureClass2,
                                                Name         = featureClass2.AliasName
                                            });
                                        }
                                    }
                                    ITopologyLayer topologyLayer = new TopologyLayer() as ITopologyLayer;
                                    topologyLayer.Topology         = (dataset as ITopology);
                                    (topologyLayer as ILayer).Name = dataset.Name;
                                    list.Add(topologyLayer as ILayer);
                                }
                                else if (dataset.Type == esriDatasetType.esriDTTin)
                                {
                                    list.Add(new TinLayer
                                    {
                                        Dataset = (ITin)dataset,
                                        Name    = dataset.Name
                                    });
                                }
                                else if (dataset.Type == esriDatasetType.esriDTRasterDataset || dataset.Type == esriDatasetType.esriDTRasterBand)
                                {
                                    bool flag = true;
                                    if (!((IRasterPyramid)dataset).Present)
                                    {
                                        if (ApplicationRef.PyramidPromptType == PyramidPromptType.AlwaysBuildNoPrompt)
                                        {
                                            ((IRasterPyramid)dataset).Create();
                                        }
                                        else if (ApplicationRef.PyramidPromptType == PyramidPromptType.AlwaysPrompt)
                                        {
                                            System.Windows.Forms.DialogResult dialogResult = BuildPyramidSet.Show();
                                            if (dialogResult == System.Windows.Forms.DialogResult.Yes)
                                            {
                                                ((IRasterPyramid)dataset).Create();
                                            }
                                            else if (dialogResult == System.Windows.Forms.DialogResult.Cancel)
                                            {
                                                flag = false;
                                            }
                                        }
                                    }
                                    if (flag)
                                    {
                                        IRasterLayer rasterLayer = new RasterLayer
                                        {
                                            Cached = true
                                        };
                                        rasterLayer.CreateFromDataset((IRasterDataset)dataset);
                                        rasterLayer.Name = dataset.Name;
                                        list.Add(rasterLayer);
                                    }
                                }
                                else
                                {
                                    if (dataset.Type == esriDatasetType.esriDTTable)
                                    {
                                        try
                                        {
                                            IRasterCatalogTable rasterCatalogTable = new RasterCatalogTable();
                                            rasterCatalogTable.Table = (ITable)dataset;
                                            rasterCatalogTable.Update();
                                            IRasterCatalogLayer rasterCatalogLayer = new RasterCatalogLayer() as IRasterCatalogLayer;
                                            rasterCatalogLayer.Create(rasterCatalogTable);
                                            rasterCatalogLayer.Name = dataset.BrowseName;
                                            list.Add(rasterCatalogLayer);
                                            goto IL_8B0;
                                        }
                                        catch (Exception ex)
                                        {
                                            try
                                            {
                                                IStandaloneTableCollection standaloneTableCollection = this.method_0() as IStandaloneTableCollection;
                                                IPropertySet connectionProperties = dataset.Workspace.ConnectionProperties;
                                                bool         flag2 = false;
                                                for (int j = 0; j < standaloneTableCollection.StandaloneTableCount; j++)
                                                {
                                                    ITable table = standaloneTableCollection.get_StandaloneTable(j).Table;
                                                    if (
                                                        connectionProperties.IsEqual(
                                                            (table as IDataset).Workspace.ConnectionProperties) &&
                                                        (table as IDataset).Name == dataset.Name)
                                                    {
                                                        flag2 = true;
                                                    }
                                                    else
                                                    {
                                                        standaloneTableCollection.AddStandaloneTable(new StandaloneTable
                                                        {
                                                            Table = dataset as ITable
                                                        });
                                                    }
                                                }
                                            }
                                            catch (Exception exception_)
                                            {
                                                CErrorLog.writeErrorLog(this, exception_, "");
                                            }

                                            goto IL_8B0;
                                        }
                                    }
                                    if (dataset.Type == esriDatasetType.esriDTGeometricNetwork)
                                    {
                                        IGeometricNetwork geometricNetwork = dataset as IGeometricNetwork;
                                        if (geometricNetwork != null)
                                        {
                                            IEnumFeatureClass enumFeatureClass = geometricNetwork.get_ClassesByType(esriFeatureType.esriFTSimpleJunction);
                                            enumFeatureClass.Reset();
                                            for (IFeatureClass featureClass3 = enumFeatureClass.Next(); featureClass3 != null; featureClass3 = enumFeatureClass.Next())
                                            {
                                                list.Add(new FeatureLayer
                                                {
                                                    FeatureClass = featureClass3,
                                                    Name         = (featureClass3 as IDataset).Name
                                                });
                                            }
                                            enumFeatureClass = geometricNetwork.get_ClassesByType(esriFeatureType.esriFTComplexJunction);
                                            enumFeatureClass.Reset();
                                            for (IFeatureClass featureClass3 = enumFeatureClass.Next(); featureClass3 != null; featureClass3 = enumFeatureClass.Next())
                                            {
                                                list.Add(new FeatureLayer
                                                {
                                                    FeatureClass = featureClass3,
                                                    Name         = (featureClass3 as IDataset).Name
                                                });
                                            }
                                            enumFeatureClass = geometricNetwork.get_ClassesByType(esriFeatureType.esriFTSimpleEdge);
                                            enumFeatureClass.Reset();
                                            for (IFeatureClass featureClass3 = enumFeatureClass.Next(); featureClass3 != null; featureClass3 = enumFeatureClass.Next())
                                            {
                                                list.Add(new FeatureLayer
                                                {
                                                    FeatureClass = featureClass3,
                                                    Name         = (featureClass3 as IDataset).Name
                                                });
                                            }
                                            enumFeatureClass = geometricNetwork.get_ClassesByType(esriFeatureType.esriFTComplexEdge);
                                            enumFeatureClass.Reset();
                                            for (IFeatureClass featureClass3 = enumFeatureClass.Next(); featureClass3 != null; featureClass3 = enumFeatureClass.Next())
                                            {
                                                list.Add(new FeatureLayer
                                                {
                                                    FeatureClass = featureClass3,
                                                    Name         = (featureClass3 as IDataset).Name
                                                });
                                            }
                                        }
                                    }
                                    else if (dataset.Type == esriDatasetType.esriDTNetworkDataset)
                                    {
                                        INetworkDataset networkDataset = dataset as INetworkDataset;
                                        INetworkLayer   item           = new NetworkLayer() as INetworkLayer;
                                        item.NetworkDataset = networkDataset;

                                        list.Add(item as ILayer);
                                        if (System.Windows.Forms.MessageBox.Show("是否将参加网络要素集-" + dataset.Name + "-的所有要素添加到地图中", "添加拓扑层", System.Windows.Forms.MessageBoxButtons.YesNo, System.Windows.Forms.MessageBoxIcon.Asterisk) == System.Windows.Forms.DialogResult.Yes)
                                        {
                                            IEnumFeatureClass classes = (dataset as IFeatureClassContainer).Classes;
                                            classes.Reset();
                                            for (IFeatureClass featureClass2 = classes.Next(); featureClass2 != null; featureClass2 = classes.Next())
                                            {
                                                list.Add(new FeatureLayer
                                                {
                                                    FeatureClass = featureClass2,
                                                    Name         = featureClass2.AliasName
                                                });
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    IL_8B0 :;
                }
                int    num   = list.Count;
                ILayer layer = null;
                for (int i = num - 1; i >= 0; i--)
                {
                    layer = list[i];
                    if (layer is IRasterCatalogLayer)
                    {
                        this.method_0().AddLayer(layer);
                        (this.method_0() as IActiveView).PartialRefresh(esriViewDrawPhase.esriViewGeography, layer, null);
                        list.RemoveAt(i);
                        num--;
                    }
                }
                for (int i = num - 1; i >= 0; i--)
                {
                    layer = list[i];
                    if (layer is IRasterLayer)
                    {
                        this.method_0().AddLayer(layer);
                        (this.method_0() as IActiveView).PartialRefresh(esriViewDrawPhase.esriViewGeography, layer, null);
                        list.RemoveAt(i);
                        num--;
                    }
                }
                for (int i = num - 1; i >= 0; i--)
                {
                    layer = list[i];
                    if (layer is ITinLayer)
                    {
                        this.method_0().AddLayer(layer);
                        (this.method_0() as IActiveView).PartialRefresh(esriViewDrawPhase.esriViewGeography, layer, null);
                        list.RemoveAt(i);
                        num--;
                    }
                }
                for (int i = num - 1; i >= 0; i--)
                {
                    layer = list[i];
                    if (layer is ICadLayer)
                    {
                        this.method_0().AddLayer(layer);
                        (this.method_0() as IActiveView).PartialRefresh(esriViewDrawPhase.esriViewGeography, layer, null);
                        list.RemoveAt(i);
                        num--;
                    }
                }
                for (int i = num - 1; i >= 0; i--)
                {
                    layer = list[i];
                    if (layer is IFeatureLayer)
                    {
                        IFeatureLayer featureLayer = layer as IFeatureLayer;
                        IFeatureClass featureClass = featureLayer.FeatureClass;
                        if (featureClass.ShapeType == esriGeometryType.esriGeometryPolygon || featureClass.ShapeType == esriGeometryType.esriGeometryEnvelope)
                        {
                            this.method_0().AddLayer(layer);
                            (this.method_0() as IActiveView).PartialRefresh(esriViewDrawPhase.esriViewGeography, layer, null);
                            list.RemoveAt(i);
                            num--;
                        }
                    }
                }
                for (int i = num - 1; i >= 0; i--)
                {
                    layer = list[i];
                    if (layer is IFeatureLayer)
                    {
                        IFeatureLayer featureLayer = layer as IFeatureLayer;
                        IFeatureClass featureClass = featureLayer.FeatureClass;
                        if (featureClass.ShapeType == esriGeometryType.esriGeometryLine || featureClass.ShapeType == esriGeometryType.esriGeometryBezier3Curve || featureClass.ShapeType == esriGeometryType.esriGeometryCircularArc || featureClass.ShapeType == esriGeometryType.esriGeometryEllipticArc || featureClass.ShapeType == esriGeometryType.esriGeometryPath || featureClass.ShapeType == esriGeometryType.esriGeometryPolyline)
                        {
                            try
                            {
                                this.method_0().AddLayer(layer);
                                goto IL_B56;
                            }
                            catch
                            {
                                goto IL_B56;
                            }
                            goto IL_B4D;
IL_B56:
                            (this.method_0() as IActiveView).PartialRefresh(esriViewDrawPhase.esriViewGeography, layer, null);
                            list.RemoveAt(i);
                            num--;
                        }
                    }
                    IL_B4D :;
                }
                for (int i = num - 1; i >= 0; i--)
                {
                    layer = list[i];
                    if (layer is IFeatureLayer)
                    {
                        IFeatureLayer featureLayer = layer as IFeatureLayer;
                        IFeatureClass featureClass = featureLayer.FeatureClass;
                        if (featureClass.ShapeType == esriGeometryType.esriGeometryMultipoint || featureClass.ShapeType == esriGeometryType.esriGeometryPoint)
                        {
                            this.method_0().AddLayer(layer);
                            (this.method_0() as IActiveView).PartialRefresh(esriViewDrawPhase.esriViewGeography, layer, null);
                            list.RemoveAt(i);
                            num--;
                        }
                    }
                }
                for (int i = num - 1; i >= 0; i--)
                {
                    layer = list[i];
                    this.method_0().AddLayer(layer);
                    (this.method_0() as IActiveView).PartialRefresh(esriViewDrawPhase.esriViewGeography, layer, null);
                    list.RemoveAt(i);
                    num--;
                }
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
        }
Example #2
0
        public static void AddDataset(IBasicMap pMap, IDataset pDataset, string dsName)
        {
            IFeatureLayer fDOGraphicsLayerClass;
            IFeatureClass j;
            IFeatureLayer featureLayerClass;

            if (dsName == null)
            {
                dsName = "";
            }
            switch (pDataset.Type)
            {
            case esriDatasetType.esriDTFeatureDataset:
            {
                IEnumDataset subsets = pDataset.Subsets;
                subsets.Reset();
                for (IDataset i = subsets.Next(); i != null; i = subsets.Next())
                {
                    MapHelper.AddDataset(pMap, i, dsName);
                }
                return;
            }

            case esriDatasetType.esriDTFeatureClass:
            {
                IFeatureClass idataset0 = (IFeatureClass)pDataset;
                if (idataset0.FeatureType == esriFeatureType.esriFTAnnotation)
                {
                    fDOGraphicsLayerClass = new FDOGraphicsLayerClass();
                    try
                    {
                        fDOGraphicsLayerClass.FeatureClass = idataset0;
                        fDOGraphicsLayerClass.Name         = string.Concat(dsName, idataset0.AliasName);
                        pMap.AddLayer(fDOGraphicsLayerClass);
                        return;
                    }
                    catch (Exception exception)
                    {
                        exception.ToString();
                        return;
                    }
                }
                else if (idataset0.FeatureType != esriFeatureType.esriFTDimension)
                {
                    fDOGraphicsLayerClass = new FeatureLayerClass()
                    {
                        FeatureClass = idataset0,
                        Name         = string.Concat(dsName, idataset0.AliasName)
                    };
                    pMap.AddLayer(fDOGraphicsLayerClass);
                    return;
                }
                else
                {
                    fDOGraphicsLayerClass = new DimensionLayerClass()
                    {
                        FeatureClass = idataset0,
                        Name         = string.Concat(dsName, idataset0.AliasName)
                    };
                    pMap.AddLayer(fDOGraphicsLayerClass);
                    return;
                }
                break;
            }

            case esriDatasetType.esriDTPlanarGraph:
            case esriDatasetType.esriDTText:
            case esriDatasetType.esriDTRelationshipClass:
            {
                return;
            }

            case esriDatasetType.esriDTGeometricNetwork:
            {
                IGeometricNetwork geometricNetwork = pDataset as IGeometricNetwork;
                if (geometricNetwork == null)
                {
                    return;
                }
                IEnumFeatureClass classesByType =
                    geometricNetwork.ClassesByType[esriFeatureType.esriFTSimpleJunction];
                classesByType.Reset();
                for (j = classesByType.Next(); j != null; j = classesByType.Next())
                {
                    featureLayerClass = new FeatureLayerClass()
                    {
                        FeatureClass = j,
                        Name         = string.Concat(dsName, (j as IDataset).Name)
                    };
                    pMap.AddLayer(featureLayerClass);
                }
                classesByType = geometricNetwork.ClassesByType[esriFeatureType.esriFTComplexJunction];
                classesByType.Reset();
                for (j = classesByType.Next(); j != null; j = classesByType.Next())
                {
                    featureLayerClass = new FeatureLayerClass()
                    {
                        FeatureClass = j,
                        Name         = string.Concat(dsName, (j as IDataset).Name)
                    };
                    pMap.AddLayer(featureLayerClass);
                }
                classesByType = geometricNetwork.ClassesByType[esriFeatureType.esriFTSimpleEdge];
                classesByType.Reset();
                for (j = classesByType.Next(); j != null; j = classesByType.Next())
                {
                    featureLayerClass = new FeatureLayerClass()
                    {
                        FeatureClass = j,
                        Name         = string.Concat(dsName, (j as IDataset).Name)
                    };
                    pMap.AddLayer(featureLayerClass);
                }
                classesByType = geometricNetwork.ClassesByType[esriFeatureType.esriFTComplexEdge];
                classesByType.Reset();
                for (j = classesByType.Next(); j != null; j = classesByType.Next())
                {
                    featureLayerClass = new FeatureLayerClass()
                    {
                        FeatureClass = j,
                        Name         = string.Concat(dsName, (j as IDataset).Name)
                    };
                    pMap.AddLayer(featureLayerClass);
                }
                return;
            }

            case esriDatasetType.esriDTTopology:
            {
                ITopologyLayer topologyLayerClass = new TopologyLayerClass()
                {
                    Topology = pDataset as ITopology
                };
                (topologyLayerClass as ILayer).Name = string.Concat(dsName, pDataset.Name);
                pMap.AddLayer(topologyLayerClass as ILayer);
                return;
            }

            case esriDatasetType.esriDTTable:
            {
                try
                {
                    IRasterCatalogTable rasterCatalogTableClass = new RasterCatalogTable()
                    {
                        Table = (ITable)pDataset
                    };
                    rasterCatalogTableClass.Update();
                    IRasterCatalogLayer rasterCatalogLayerClass = new RasterCatalogLayerClass();
                    rasterCatalogLayerClass.Create(rasterCatalogTableClass);
                    rasterCatalogLayerClass.Name = string.Concat(dsName, pDataset.BrowseName);
                    pMap.AddLayer(rasterCatalogLayerClass);
                    return;
                }
                catch
                {
                    try
                    {
                        IStandaloneTableCollection ibasicMap0 = pMap as IStandaloneTableCollection;
                        IPropertySet connectionProperties     = pDataset.Workspace.ConnectionProperties;
                        bool         flag = false;
                        int          num  = 0;
                        while (true)
                        {
                            if (num < ibasicMap0.StandaloneTableCount)
                            {
                                ITable table = ibasicMap0.StandaloneTable[num].Table;
                                if (
                                    !connectionProperties.IsEqual((table as IDataset).Workspace.ConnectionProperties) ||
                                    !((table as IDataset).Name == pDataset.Name))
                                {
                                    num++;
                                }
                                else
                                {
                                    flag = true;
                                    break;
                                }
                            }
                            else
                            {
                                break;
                            }
                        }
                        if (!flag)
                        {
                            ibasicMap0.AddStandaloneTable(new StandaloneTableClass()
                                {
                                    Table = pDataset as ITable
                                });
                        }
                    }
                    catch (Exception exception1)
                    {
                        Logger.Current.Write(exception1.Message, LogLevel.Error, null);
                    }
                    return;
                }
                break;
            }

            case esriDatasetType.esriDTRasterDataset:
            case esriDatasetType.esriDTRasterBand:
            {
                IRasterLayer rasterLayerClass = new RasterLayerClass();
                rasterLayerClass.CreateFromDataset((IRasterDataset)pDataset);
                rasterLayerClass.Name = string.Concat(dsName, pDataset.Name);
                pMap.AddLayer(rasterLayerClass);
                return;
            }

            case esriDatasetType.esriDTTin:
            {
                ITinLayer tinLayerClass = new TinLayerClass()
                {
                    Dataset = (ITin)pDataset,
                    Name    = string.Concat(dsName, pDataset.Name)
                };
                pMap.AddLayer(tinLayerClass);
                return;
            }

            case esriDatasetType.esriDTCadDrawing:
            {
                ICadLayer cadLayerClass = new CadLayerClass()
                {
                    CadDrawingDataset = pDataset as ICadDrawingDataset,
                    Name = pDataset.Name
                };
                pMap.AddLayer(cadLayerClass);
                return;
            }

            default:
            {
                return;
            }
            }
        }
Example #3
0
        public static void AddDataset(IBasicMap ibasicMap_0, IDataset idataset_0, string string_0)
        {
            if (string_0 == null)
            {
                string_0 = "";
            }
            switch (idataset_0.Type)
            {
            case esriDatasetType.esriDTFeatureDataset:
            {
                IEnumDataset subsets = idataset_0.Subsets;
                subsets.Reset();
                for (IDataset dataset2 = subsets.Next(); dataset2 != null; dataset2 = subsets.Next())
                {
                    AddDataset(ibasicMap_0, dataset2, string_0);
                }
                break;
            }

            case esriDatasetType.esriDTFeatureClass:
            {
                IFeatureLayer layer;
                IFeatureClass class2 = (IFeatureClass)idataset_0;
                if (class2.FeatureType != esriFeatureType.esriFTAnnotation)
                {
                    if (class2.FeatureType == esriFeatureType.esriFTDimension)
                    {
                        IFeatureLayer dimensionLayer = new DimensionLayer() as IFeatureLayer;
                        dimensionLayer.FeatureClass = class2;
                        dimensionLayer.Name         = string_0 + class2.AliasName;
                        layer = dimensionLayer as IFeatureLayer;
                        ibasicMap_0.AddLayer(layer);
                    }
                    else
                    {
                        layer = new FeatureLayer
                        {
                            FeatureClass = class2,
                            Name         = string_0 + class2.AliasName
                        };
                        ibasicMap_0.AddLayer(layer);
                    }
                    break;
                }
                layer = new FDOGraphicsLayer() as IFeatureLayer;
                try
                {
                    layer.FeatureClass = class2;
                    layer.Name         = string_0 + class2.AliasName;
                    ibasicMap_0.AddLayer(layer);
                }
                catch (Exception exception)
                {
                    exception.ToString();
                }
                break;
            }

            case esriDatasetType.esriDTGeometricNetwork:
            {
                IGeometricNetwork network = idataset_0 as IGeometricNetwork;
                if (network != null)
                {
                    IFeatureLayer     layer7;
                    IEnumFeatureClass class3 = network.get_ClassesByType(esriFeatureType.esriFTSimpleJunction);
                    class3.Reset();
                    IFeatureClass class4 = class3.Next();
                    while (class4 != null)
                    {
                        layer7 = new FeatureLayer
                        {
                            FeatureClass = class4,
                            Name         = string_0 + (class4 as IDataset).Name
                        };
                        ibasicMap_0.AddLayer(layer7);
                        class4 = class3.Next();
                    }
                    class3 = network.get_ClassesByType(esriFeatureType.esriFTComplexJunction);
                    class3.Reset();
                    for (class4 = class3.Next(); class4 != null; class4 = class3.Next())
                    {
                        layer7 = new FeatureLayer
                        {
                            FeatureClass = class4,
                            Name         = string_0 + (class4 as IDataset).Name
                        };
                        ibasicMap_0.AddLayer(layer7);
                    }
                    class3 = network.get_ClassesByType(esriFeatureType.esriFTSimpleEdge);
                    class3.Reset();
                    for (class4 = class3.Next(); class4 != null; class4 = class3.Next())
                    {
                        layer7 = new FeatureLayer
                        {
                            FeatureClass = class4,
                            Name         = string_0 + (class4 as IDataset).Name
                        };
                        ibasicMap_0.AddLayer(layer7);
                    }
                    class3 = network.get_ClassesByType(esriFeatureType.esriFTComplexEdge);
                    class3.Reset();
                    for (class4 = class3.Next(); class4 != null; class4 = class3.Next())
                    {
                        layer7 = new FeatureLayer
                        {
                            FeatureClass = class4,
                            Name         = string_0 + (class4 as IDataset).Name
                        };
                        ibasicMap_0.AddLayer(layer7);
                    }
                }
                break;
            }

            case esriDatasetType.esriDTTopology:
            {
                ITopologyLayer layer = new TopologyLayer() as ITopologyLayer;
                layer.Topology = idataset_0 as ITopology;
                ITopologyLayer layer3 = layer as ITopologyLayer;
                (layer3 as ILayer).Name = string_0 + idataset_0.Name;
                ibasicMap_0.AddLayer(layer3 as ILayer);
                break;
            }

            case esriDatasetType.esriDTTable:
                try
                {
                    IRasterCatalogTable pCatalog = new RasterCatalogTable
                    {
                        Table = (ITable)idataset_0
                    };
                    pCatalog.Update();
                    IRasterCatalogLayer pLayer = new RasterCatalogLayer() as IRasterCatalogLayer;
                    pLayer.Create(pCatalog);
                    pLayer.Name = string_0 + idataset_0.BrowseName;
                    ibasicMap_0.AddLayer(pLayer);
                }
                catch
                {
                    try
                    {
                        IStandaloneTableCollection tables = ibasicMap_0 as IStandaloneTableCollection;
                        IPropertySet connectionProperties = idataset_0.Workspace.ConnectionProperties;
                        bool         flag = false;
                        for (int i = 0; i < tables.StandaloneTableCount; i++)
                        {
                            ITable table = tables.get_StandaloneTable(i).Table;
                            if (connectionProperties.IsEqual((table as IDataset).Workspace.ConnectionProperties) &&
                                ((table as IDataset).Name == idataset_0.Name))
                            {
                                goto Label_03E1;
                            }
                        }
                        goto Label_03E4;
Label_03E1:
                        flag = true;
Label_03E4:
                        if (!flag)
                        {
                            IStandaloneTable table3 = new StandaloneTable
                            {
                                Table = idataset_0 as ITable
                            };
                            tables.AddStandaloneTable(table3);
                        }
                    }
                    catch (Exception exception2)
                    {
                        CErrorLog.writeErrorLog(null, exception2, "");
                    }
                }
                break;

            case esriDatasetType.esriDTRasterDataset:
            case esriDatasetType.esriDTRasterBand:
            {
                IRasterLayer layer5 = new RasterLayer();
                layer5.CreateFromDataset((IRasterDataset)idataset_0);
                layer5.Name = string_0 + idataset_0.Name;
                ibasicMap_0.AddLayer(layer5);
                break;
            }

            case esriDatasetType.esriDTTin:
            {
                ITinLayer layer4 = new TinLayer
                {
                    Dataset = (ITin)idataset_0,
                    Name    = string_0 + idataset_0.Name
                };
                ibasicMap_0.AddLayer(layer4);
                break;
            }

            case esriDatasetType.esriDTCadDrawing:
            {
                ICadLayer layer2 = new CadLayer() as ICadLayer;
                layer2.CadDrawingDataset = idataset_0 as ICadDrawingDataset;
                layer2.Name = idataset_0.Name;
                ibasicMap_0.AddLayer(layer2);
                break;
            }
            }
        }