Exemplo n.º 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}");
        }
Exemplo n.º 2
0
        public static IFeatureClass TryOpenFromMasterDatabase(
            [NotNull] IVectorDataset dataset, bool allowAlways = false)
        {
            IDatasetContext context = GetMasterDatabaseWorkspaceContext(dataset,
                                                                        allowAlways);

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