private void CopyCurrentDatasetFromAddedCoverage(GdalFunctionStore gdalFunctionStore, Driver gdalDriver) { gdalDataset = gdalDriver.CreateCopy(path, gdalFunctionStore.gdalDataset, 0, new string[] { }, null, "Copy"); //substitute driver by in-memory driver in case driver is read-only if (GdalHelper.IsCreateCopyOnlySupported(gdalDriver)) { using (var inMemoryDriver = Gdal.GetDriverByName("MEM")) { var oldGdalDataSet = gdalDataset; //create in-memory dataset with a copy of the original data. gdalDataset = inMemoryDriver.CreateCopy(path, gdalFunctionStore.gdalDataset, 0, new string[] { }, null, null); oldGdalDataSet.Dispose(); } } }
// ICloneable public object Clone() { var clone = new GdalFunctionStore { Path = Path, FireEvents = FireEvents }; clone.Open(); // replace all function names in the cloned store by the current function names (GDAL store may not remember them) for (var i = 0; i < Functions.Count; i++) { clone.Functions[i].Name = Functions[i].Name; } //if(IsOpen) //{ // clone.Open(); //} return(clone); }
// ICloneable public object Clone() { var clone = new GdalFunctionStore { FireEvents = FireEvents }; try { clone.Open(Path); // replace all function names in the cloned store by the current function names (GDAL store may not remember them) for (var i = 0; i < Functions.Count; i++) { clone.Functions[i].Name = Functions[i].Name; } } catch (Exception e) { // swallow exception because we can be seen as IFeatureProvider log.Error("Can't open file: " + Path, e); } return(clone); }
public GdalFeatureProvider() { store = new GdalFunctionStore(); }