Exemplo n.º 1
0
        public static ILayer CreateLayer(ICatalogItem catalogItem)
        {
            if (catalogItem == null || catalogItem.Dataset == null)
            {
                return(null);
            }

            ILayer          lyrNew      = null;
            enumCatalogType catalogType = catalogItem.Type;

            switch (catalogType)
            {
            case enumCatalogType.Workpace:
            case enumCatalogType.FeatureDataset:
            case enumCatalogType.Table:
                return(null);

            case enumCatalogType.FeatureClassPoint:
            case enumCatalogType.FeatureClassLine:
            case enumCatalogType.FeatureClassArea:
            case enumCatalogType.FeatureClassAnnotation:
            case enumCatalogType.FeatureClassEmpty:
            case enumCatalogType.FeatureClass3D:
            case enumCatalogType.RasterCatalog:
                IFeatureLayer lyrFeature = new FeatureLayerClass();
                lyrFeature.FeatureClass = catalogItem.Dataset as IFeatureClass;
                lyrNew = lyrFeature;
                break;

            case enumCatalogType.RasterMosaic:
            case enumCatalogType.RasterSet:
                IRasterLayer lyrRaster = new RasterLayerClass();
                lyrRaster.CreateFromDataset(catalogItem.Dataset as IRasterDataset);
                lyrNew = lyrRaster;
                break;

            case enumCatalogType.RasterBand:
                IRasterLayer          lyrRasterBand = new RasterLayerClass();
                IRasterBand           rasterBand    = catalogItem.Dataset as IRasterBand;
                IRasterBandCollection colRasterBand = new RasterClass();
                colRasterBand.Add(rasterBand, 0);
                lyrRasterBand.CreateFromRaster(colRasterBand as IRaster);

                lyrNew = lyrRasterBand;
                break;

            case enumCatalogType.Tin:
                ITinLayer lyrTin = new TinLayerClass();
                lyrTin.Dataset = catalogItem.Dataset as ITin;
                lyrNew         = lyrTin;
                break;

            case enumCatalogType.Terrain:
                ITerrainLayer lyrTerrain = new TerrainLayerClass();
                lyrTerrain.Terrain = catalogItem.Dataset as ITerrain;
                lyrNew             = lyrTerrain;
                break;

            case enumCatalogType.Topology:
                ITopologyLayer lyrTopology = new TopologyLayerClass();
                lyrTopology.Topology = catalogItem.Dataset as ITopology;
                lyrNew = lyrTopology as ILayer;
                break;
            }

            return(lyrNew);
        }
Exemplo n.º 2
0
 //protected CatalogItem(IDataset ds, ICatalogItem parent)
 //{
 //    this.m_Dataset = ds;
 //    this.m_Parent = parent;
 //    this.m_Type = GetCatalogType();
 //}
 protected CatalogItem(IDatasetName dsName, ICatalogItem parent)
 {
     this.m_DatasetName = dsName;
     this.m_Parent = parent;
     this.m_Type = GetCatalogType(dsName);
 }
Exemplo n.º 3
0
        //protected CatalogItem(IDataset ds, ICatalogItem parent)
        //{
        //    this.m_Dataset = ds;
        //    this.m_Parent = parent;
        //    this.m_Type = GetCatalogType();
        //}

        protected CatalogItem(IDatasetName dsName, ICatalogItem parent)
        {
            this.m_DatasetName = dsName;
            this.m_Parent      = parent;
            this.m_Type        = GetCatalogType(dsName);
        }