diff --git a/MeshLib/MeshGenerators/LayeredMeshGenerator.cpp b/MeshLib/MeshGenerators/LayeredMeshGenerator.cpp index bb02e14ac497c4b67b54f92046d580eb80e6e74b..ec7b5ee08a5c74d27321c6d741b86d420276d992 100644 --- a/MeshLib/MeshGenerators/LayeredMeshGenerator.cpp +++ b/MeshLib/MeshGenerators/LayeredMeshGenerator.cpp @@ -19,8 +19,6 @@ #include <logog/include/logog.hpp> -#include "FileIO/AsciiRasterInterface.h" - #include "GeoLib/Raster.h" #include "MeshLib/Mesh.h" @@ -37,19 +35,15 @@ LayeredMeshGenerator::LayeredMeshGenerator() { } -bool LayeredMeshGenerator::createLayers(MeshLib::Mesh const& mesh, - std::vector<std::string> const& raster_paths, - double minimum_thickness, - double noDataReplacementValue) +bool LayeredMeshGenerator::createLayers( + MeshLib::Mesh const& mesh, + std::vector<GeoLib::Raster const*> const& rasters, + double minimum_thickness, + double noDataReplacementValue) { - if (mesh.getDimension() != 2 || !FileIO::allRastersExist(raster_paths)) + if (mesh.getDimension() != 2) return false; - std::vector<GeoLib::Raster const*> rasters; - rasters.reserve(raster_paths.size()); - for (auto path = raster_paths.begin(); path != raster_paths.end(); ++path) - rasters.push_back(FileIO::AsciiRasterInterface::readRaster(*path)); - bool result = createRasterLayers(mesh, rasters, minimum_thickness, noDataReplacementValue); std::for_each(rasters.begin(), rasters.end(), [](GeoLib::Raster const*const raster){ delete raster; }); return result; diff --git a/MeshLib/MeshGenerators/LayeredMeshGenerator.h b/MeshLib/MeshGenerators/LayeredMeshGenerator.h index 522b962069f9481e464a9de720aaa8fc19b6f7be..6917043bae6dcc503bae7771b350d9ec2b4ddbdb 100644 --- a/MeshLib/MeshGenerators/LayeredMeshGenerator.h +++ b/MeshLib/MeshGenerators/LayeredMeshGenerator.h @@ -39,13 +39,13 @@ public: /** * Returns a subsurface representation of a region represented by a 2D mesh by reading raster files and calling the appropriate construction method. * @param mesh The 2D surface mesh that is used as a basis for the subsurface mesh - * @param raster_paths Containing all the raster-file-names for the subsurface layers from bottom to top (starting with the bottom of the oldest layer and ending with the DEM) + * @param rasters Containing all the rasters for the subsurface layers from bottom to top (starting with the bottom of the oldest layer and ending with the DEM) * @param minimum_thickness Minimum thickness of each of the newly created layers (i.e. nodes with a vertical distance smaller than this will be collapsed) * @param noDataReplacementValue Default z-coordinate if there are mesh nodes not located on the DEM raster (i.e. raster_paths[0]) * @result true if the subsurface representation has been created, false if there was an error */ virtual bool createLayers(MeshLib::Mesh const& mesh, - std::vector<std::string> const& raster_paths, + std::vector<GeoLib::Raster const*> const& rasters, double minimum_thickness, double noDataReplacementValue = 0.0) final;