예제 #1
0
        private object OpenKnownDatasetType(IDdxDataset dataset, Type knownType)
        {
            Assert.ArgumentNotNull(knownType, nameof(knownType));

            if (typeof(IFeatureClass) == knownType)
            {
                return(_datasetContext.OpenFeatureClass((IVectorDataset)dataset));
            }

            if (typeof(ITable) == knownType)
            {
                return(_datasetContext.OpenTable((IObjectDataset)dataset));
            }

            if (typeof(IMosaicDataset) == knownType)
            {
                return((IMosaicDataset)_datasetContext.OpenRasterDataset(
                           (IDdxRasterDataset)dataset));
            }

            if (typeof(IRasterDataset) == knownType)
            {
                return(_datasetContext.OpenRasterDataset((IDdxRasterDataset)dataset));
            }

            if (typeof(IRasterDataset2) == knownType)
            {
                return((IRasterDataset2)_datasetContext.OpenRasterDataset(
                           (IDdxRasterDataset)dataset));
            }

            throw new ArgumentException($"Unsupported data type {knownType}");
        }
예제 #2
0
        public static IRasterDataset TryOpenFromMasterDatabase(IDdxRasterDataset dataset,
                                                               bool allowAlways = false)
        {
            IDatasetContext context = GetMasterDatabaseWorkspaceContext(dataset,
                                                                        allowAlways);

            return(context?.OpenRasterDataset(dataset));
        }