/// <summary> /// This open method is only called if this plugin has been given priority for one /// of the file extensions supported in the DialogReadFilter property supplied by /// this control. Failing to provide a DialogReadFilter will result in this plugin /// being added to the list of DataProviders being supplied under the Add Other Data /// option in the file menu. /// </summary> /// <param name="fileName">A string specifying the complete path and extension of the file to open.</param> /// <returns>An IDataSet to be added to the Map. These can also be groups of datasets.</returns> public virtual IRaster Open(string fileName) { RasterDataType fileDataType = GetDataType(fileName); switch (fileDataType) { case RasterDataType.SINGLE: BgdRaster<float> fRast = new BgdRaster<float> { ProgressHandler = _progressHandler, Filename = fileName }; fRast.Open(); return fRast; case RasterDataType.DOUBLE: BgdRaster<double> dRast = new BgdRaster<double> { ProgressHandler = _progressHandler, Filename = fileName }; dRast.Open(); return dRast; case RasterDataType.SHORT: BgdRaster<short> sRast = new BgdRaster<short> { ProgressHandler = _progressHandler, Filename = fileName }; sRast.Open(); return sRast; case RasterDataType.INTEGER: BgdRaster<int> iRast = new BgdRaster<int> { ProgressHandler = _progressHandler, Filename = fileName }; iRast.Open(); return iRast; case RasterDataType.BYTE: BgdRaster<byte> bRast = new BgdRaster<byte> { ProgressHandler = _progressHandler, Filename = fileName }; bRast.Open(); return bRast; default: return null; } }
/// <summary> /// This open method is only called if this plugin has been given priority for one /// of the file extensions supported in the DialogReadFilter property supplied by /// this control. Failing to provide a DialogReadFilter will result in this plugin /// being added to the list of DataProviders being supplied under the Add Other Data /// option in the file menu. /// </summary> /// <param name="filename">A string specifying the complete path and extension of the file to open.</param> /// <returns>An IDataSet to be added to the Map. These can also be groups of datasets.</returns> public virtual IRaster Open(string filename) { RasterDataTypes FileDataType = GetDataType(filename); switch (FileDataType) { case RasterDataTypes.SINGLE: BgdRaster<float> fRast = new BgdRaster<float>(filename); fRast.ProgressHandler = _progressHandler; fRast.Open(); return fRast; case RasterDataTypes.DOUBLE: BgdRaster<double> dRast = new BgdRaster<double>(filename); dRast.ProgressHandler = _progressHandler; dRast.Open(); return dRast; case RasterDataTypes.SHORT: BgdRaster<short> sRast = new BgdRaster<short>(filename); sRast.ProgressHandler = _progressHandler; sRast.Open(); return sRast; case RasterDataTypes.INTEGER: BgdRaster<int> iRast = new BgdRaster<int>(filename); iRast.ProgressHandler = _progressHandler; iRast.Open(); return iRast; default: return null; } }
/// <summary> /// This open method is only called if this plugin has been given priority for one /// of the file extensions supported in the DialogReadFilter property supplied by /// this control. Failing to provide a DialogReadFilter will result in this plugin /// being added to the list of DataProviders being supplied under the Add Other Data /// option in the file menu. /// </summary> /// <param name="fileName">A string specifying the complete path and extension of the file to open.</param> /// <returns>An IDataSet to be added to the Map. These can also be groups of datasets.</returns> public virtual IRaster Open(string fileName) { RasterDataType fileDataType = GetDataType(fileName); Raster raster = null; switch (fileDataType) { case RasterDataType.BYTE: raster = new BgdRaster<byte> { ProgressHandler = _progressHandler, Filename = fileName }; break; case RasterDataType.SHORT: raster = new BgdRaster<short> { ProgressHandler = _progressHandler, Filename = fileName }; break; case RasterDataType.INTEGER: raster = new BgdRaster<int> { ProgressHandler = _progressHandler, Filename = fileName }; break; case RasterDataType.LONG: raster = new BgdRaster<long> { ProgressHandler = _progressHandler, Filename = fileName }; break; case RasterDataType.SINGLE: raster = new BgdRaster<float> { ProgressHandler = _progressHandler, Filename = fileName }; break; case RasterDataType.DOUBLE: raster = new BgdRaster<double> { ProgressHandler = _progressHandler, Filename = fileName }; break; case RasterDataType.SBYTE: raster = new BgdRaster<sbyte> { ProgressHandler = _progressHandler, Filename = fileName }; break; case RasterDataType.USHORT: raster = new BgdRaster<ushort> { ProgressHandler = _progressHandler, Filename = fileName }; break; case RasterDataType.UINTEGER: raster = new BgdRaster<uint> { ProgressHandler = _progressHandler, Filename = fileName }; break; case RasterDataType.ULONG: raster = new BgdRaster<ulong> { ProgressHandler = _progressHandler, Filename = fileName }; break; case RasterDataType.BOOL: raster = new BgdRaster<bool> { ProgressHandler = _progressHandler, Filename = fileName }; break; } if (raster != null) raster.Open(); return raster; }
/// <summary> /// This create new method implies that this provider has the priority for creating a new file. /// An instance of the dataset should be created and then returned. By this time, the fileName /// will already be checked to see if it exists, and deleted if the user wants to overwrite it. /// </summary> /// <param name="name">The string fileName for the new instance</param> /// <param name="driverCode">The string short name of the driver for creating the raster</param> /// <param name="xSize">The number of columns in the raster</param> /// <param name="ySize">The number of rows in the raster</param> /// <param name="numBands">The number of bands to create in the raster</param> /// <param name="dataType">The data type to use for the raster</param> /// <param name="options">The options to be used.</param> /// <returns>An IRaster</returns> public IRaster Create(string name, string driverCode, int xSize, int ySize, int numBands, Type dataType, string[] options) { if (dataType == typeof(short)) { BgdRaster<short> r = new BgdRaster<short>(name, ySize, xSize); return r; } if (dataType == typeof(int)) { BgdRaster<int> r = new BgdRaster<int>(name, ySize, xSize); return r; } if (dataType == typeof(float)) { BgdRaster<float> r = new BgdRaster<float>(name, ySize, xSize); return r; } if (dataType == typeof(double)) { BgdRaster<double> r = new BgdRaster<double>(name, ySize, xSize); return r; } if (dataType == typeof(byte)) { BgdRaster<byte> r = new BgdRaster<byte>(name, ySize, xSize); return r; } return null; }