From 29fbc5986246f1fee12ca7ea893318f3616b8087 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <dmitri.naumov@ufz.de> Date: Thu, 14 Apr 2016 22:48:11 +0200 Subject: [PATCH] Use readRasters to pass them to createLayers(). --- .../DataExplorer/DataView/MeshLayerEditDialog.cpp | 9 +++++++-- .../Utils/MeshEdit/createLayeredMeshFromRasters.cpp | 8 +++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Applications/DataExplorer/DataView/MeshLayerEditDialog.cpp b/Applications/DataExplorer/DataView/MeshLayerEditDialog.cpp index cf932d97235..4443ff0dbd2 100644 --- a/Applications/DataExplorer/DataView/MeshLayerEditDialog.cpp +++ b/Applications/DataExplorer/DataView/MeshLayerEditDialog.cpp @@ -22,6 +22,7 @@ #include "StringTools.h" #include "Mesh.h" +#include "FileIO/AsciiRasterInterface.h" #include "TetGenInterface.h" #include <QCheckBox> @@ -188,7 +189,9 @@ MeshLib::Mesh* MeshLayerEditDialog::createPrismMesh() std::vector<std::string> raster_paths; for (int i=nLayers; i>=0; --i) raster_paths.push_back(this->_edits[i]->text().toStdString()); - if (mapper.createLayers(*_msh, raster_paths, minimum_thickness)) + + auto const rasters = FileIO::readRasters(raster_paths); + if (rasters && mapper.createLayers(*_msh, *rasters, minimum_thickness)) { INFO("Mesh construction time: %d ms.", myTimer0.elapsed()); return mapper.getMesh("SubsurfaceMesh").release(); @@ -227,7 +230,9 @@ MeshLib::Mesh* MeshLayerEditDialog::createTetMesh() for (int i=nLayers; i>=0; --i) raster_paths.push_back(this->_edits[i]->text().toStdString()); LayeredVolume lv; - if (lv.createLayers(*_msh, raster_paths, minimum_thickness)) + + auto const rasters = FileIO::readRasters(raster_paths); + if (rasters && lv.createLayers(*_msh, *rasters, minimum_thickness)) tg_mesh = lv.getMesh("SubsurfaceMesh").release(); if (tg_mesh) diff --git a/Applications/Utils/MeshEdit/createLayeredMeshFromRasters.cpp b/Applications/Utils/MeshEdit/createLayeredMeshFromRasters.cpp index f613792be63..a2d40078ea8 100644 --- a/Applications/Utils/MeshEdit/createLayeredMeshFromRasters.cpp +++ b/Applications/Utils/MeshEdit/createLayeredMeshFromRasters.cpp @@ -23,6 +23,7 @@ #include "BaseLib/FileTools.h" #include "FileIO/readMeshFromFile.h" +#include "FileIO/AsciiRasterInterface.h" #include "FileIO/writeMeshToFile.h" #include "MeshLib/Mesh.h" @@ -113,7 +114,12 @@ int main (int argc, char* argv[]) return EXIT_FAILURE; MeshLib::MeshLayerMapper mapper; - if (!mapper.createLayers(*sfc_mesh, raster_paths, min_thickness)) + if (auto rasters = FileIO::readRasters(raster_paths)) + { + if (!mapper.createLayers(*sfc_mesh, *rasters, min_thickness)) + return EXIT_FAILURE; + } + else return EXIT_FAILURE; std::string output_name (mesh_out_arg.getValue()); -- GitLab