/// <summary> /// Creates a new raster using the specified raster provider and the Data Manager's Progress Handler, /// as well as its LoadInRam property. /// </summary> /// <param name="name">The fileName of the new file to create.</param> /// <param name="driverCode">The string code identifying the driver to use to create the raster. If no code is specified /// the manager will attempt to match the extension with a code specified in the Dialog write filter. </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 in the raster</param> /// <param name="dataType">The data type for the raster</param> /// <param name="options">Any additional, driver specific options for creation</param> /// <returns>An IRaster representing the created raster.</returns> public virtual IRaster CreateRaster(string name, string driverCode, int xSize, int ySize, int numBands, Type dataType, string[] options) { // First check for the extension in the preferred plugins list string ext = Path.GetExtension(name).ToLower(); if (ext != null) { IRaster result; if (PreferredProviders.ContainsKey(ext)) { IRasterProvider rp = PreferredProviders[ext] as IRasterProvider; if (rp != null) { result = rp.Create(name, driverCode, xSize, ySize, numBands, dataType, options); if (result != null) { return(result); } } // if we get here, we found the provider, but it did not succeed in opening the file. } // Then check the general list of developer specified providers... but not the directory providers foreach (IDataProvider dp in DataProviders) { if (GetSupportedExtensions(dp.DialogWriteFilter).Contains(ext)) { IRasterProvider rp = dp as IRasterProvider; if (rp != null) { // attempt to open with the fileName. result = rp.Create(name, driverCode, xSize, ySize, numBands, dataType, options); if (result != null) { return(result); } } } } } throw new ApplicationException(DataStrings.FileTypeNotSupported); }