From c57fd77b38d8072ac8a7077a39e45e934aa3920f Mon Sep 17 00:00:00 2001
From: Thomas Fischer <thomas.fischer@ufz.de>
Date: Mon, 9 May 2016 12:46:31 +0200
Subject: [PATCH] Namespace change: AsciiRasterInterface to GeoLib::IO

---
 .../DataExplorer/DataView/DirectConditionGenerator.cpp |  4 ++--
 .../DataExplorer/DataView/MeshLayerEditDialog.cpp      |  4 ++--
 Applications/DataExplorer/DataView/MshView.cpp         |  2 +-
 Applications/DataExplorer/VtkVis/VtkRaster.cpp         |  4 ++--
 .../Utils/MeshEdit/createLayeredMeshFromRasters.cpp    |  2 +-
 .../createMeshElemPropertiesFromASCRaster.cpp          |  4 ++--
 GeoLib/IO/AsciiRasterInterface.cpp                     | 10 +++++++---
 GeoLib/IO/AsciiRasterInterface.h                       |  9 ++++++---
 MeshGeoToolsLib/GeoMapper.cpp                          |  2 +-
 9 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/Applications/DataExplorer/DataView/DirectConditionGenerator.cpp b/Applications/DataExplorer/DataView/DirectConditionGenerator.cpp
index 81a816ec4c2..5578d74dc36 100644
--- a/Applications/DataExplorer/DataView/DirectConditionGenerator.cpp
+++ b/Applications/DataExplorer/DataView/DirectConditionGenerator.cpp
@@ -34,7 +34,7 @@ const std::vector< std::pair<std::size_t,double> >& DirectConditionGenerator::di
 {
 	if (_direct_values.empty())
 	{
-		GeoLib::Raster* raster (FileIO::AsciiRasterInterface::readRaster(filename));
+		GeoLib::Raster* raster (GeoLib::IO::AsciiRasterInterface::readRaster(filename));
 		if (! raster) {
 			ERR("Error in DirectConditionGenerator::directToSurfaceNodes() - could not load raster file.");
 			return _direct_values;
@@ -70,7 +70,7 @@ const std::vector< std::pair<std::size_t,double> >& DirectConditionGenerator::di
 	}
 
 	std::unique_ptr<GeoLib::Raster> raster(
-	    FileIO::AsciiRasterInterface::readRaster(filename));
+	    GeoLib::IO::AsciiRasterInterface::readRaster(filename));
 	if (!raster) {
 		ERR(
 		    "Error in DirectConditionGenerator::directWithSurfaceIntegration()"
diff --git a/Applications/DataExplorer/DataView/MeshLayerEditDialog.cpp b/Applications/DataExplorer/DataView/MeshLayerEditDialog.cpp
index 77837c319fe..fb2541d1afa 100644
--- a/Applications/DataExplorer/DataView/MeshLayerEditDialog.cpp
+++ b/Applications/DataExplorer/DataView/MeshLayerEditDialog.cpp
@@ -190,7 +190,7 @@ MeshLib::Mesh* MeshLayerEditDialog::createPrismMesh()
 		for (int i=nLayers; i>=0; --i)
 			raster_paths.push_back(this->_edits[i]->text().toStdString());
 
-		auto const rasters = FileIO::readRasters(raster_paths);
+		auto const rasters = GeoLib::IO::readRasters(raster_paths);
 		if (rasters && mapper.createLayers(*_msh, *rasters, minimum_thickness))
 		{
 			INFO("Mesh construction time: %d ms.", myTimer0.elapsed());
@@ -231,7 +231,7 @@ MeshLib::Mesh* MeshLayerEditDialog::createTetMesh()
 			raster_paths.push_back(this->_edits[i]->text().toStdString());
 		LayeredVolume lv;
 
-		auto const rasters = FileIO::readRasters(raster_paths);
+		auto const rasters = GeoLib::IO::readRasters(raster_paths);
 		if (rasters && lv.createLayers(*_msh, *rasters, minimum_thickness))
 			tg_mesh = lv.getMesh("SubsurfaceMesh").release();
 
diff --git a/Applications/DataExplorer/DataView/MshView.cpp b/Applications/DataExplorer/DataView/MshView.cpp
index 87bf45fba7d..7ba941dd89d 100644
--- a/Applications/DataExplorer/DataView/MshView.cpp
+++ b/Applications/DataExplorer/DataView/MshView.cpp
@@ -166,7 +166,7 @@ void MshView::openMap2dMeshDialog()
 	if (dlg.useRasterMapping())
 	{
 		std::unique_ptr<GeoLib::Raster> raster{
-		    FileIO::AsciiRasterInterface::readRaster(dlg.getRasterPath())};
+		    GeoLib::IO::AsciiRasterInterface::readRaster(dlg.getRasterPath())};
 		if (!raster)
 		{
 			OGSError::box(QString::fromStdString(
diff --git a/Applications/DataExplorer/VtkVis/VtkRaster.cpp b/Applications/DataExplorer/VtkVis/VtkRaster.cpp
index 903143ac18c..9c2f629ed0b 100644
--- a/Applications/DataExplorer/VtkVis/VtkRaster.cpp
+++ b/Applications/DataExplorer/VtkVis/VtkRaster.cpp
@@ -48,9 +48,9 @@ vtkImageAlgorithm* VtkRaster::loadImage(const std::string &fileName,
 
 	std::unique_ptr<GeoLib::Raster> raster(nullptr);
 	if (fileInfo.suffix().toLower() == "asc")
-		raster.reset(FileIO::AsciiRasterInterface::getRasterFromASCFile(fileName));
+		raster.reset(GeoLib::IO::AsciiRasterInterface::getRasterFromASCFile(fileName));
 	else if (fileInfo.suffix().toLower() == "grd")
-		raster.reset(FileIO::AsciiRasterInterface::getRasterFromSurferFile(fileName));
+		raster.reset(GeoLib::IO::AsciiRasterInterface::getRasterFromSurferFile(fileName));
 	if (raster)
 		return VtkRaster::loadImageFromArray(raster->begin(), raster->getHeader());
 	else if ((fileInfo.suffix().toLower() == "tif") || (fileInfo.suffix().toLower() == "tiff"))
diff --git a/Applications/Utils/MeshEdit/createLayeredMeshFromRasters.cpp b/Applications/Utils/MeshEdit/createLayeredMeshFromRasters.cpp
index 0bfe9be63ad..a1fe56fbc82 100644
--- a/Applications/Utils/MeshEdit/createLayeredMeshFromRasters.cpp
+++ b/Applications/Utils/MeshEdit/createLayeredMeshFromRasters.cpp
@@ -114,7 +114,7 @@ int main (int argc, char* argv[])
 		return EXIT_FAILURE;
 
 	MeshLib::MeshLayerMapper mapper;
-	if (auto rasters = FileIO::readRasters(raster_paths))
+	if (auto rasters = GeoLib::IO::readRasters(raster_paths))
 	{
 		if (!mapper.createLayers(*sfc_mesh, *rasters, min_thickness))
 			return EXIT_FAILURE;
diff --git a/Applications/Utils/SimpleMeshCreation/createMeshElemPropertiesFromASCRaster.cpp b/Applications/Utils/SimpleMeshCreation/createMeshElemPropertiesFromASCRaster.cpp
index 4406fed2b12..c0c7f909614 100644
--- a/Applications/Utils/SimpleMeshCreation/createMeshElemPropertiesFromASCRaster.cpp
+++ b/Applications/Utils/SimpleMeshCreation/createMeshElemPropertiesFromASCRaster.cpp
@@ -128,7 +128,7 @@ int main (int argc, char* argv[])
 
 	// read raster and if required manipulate it
 	auto raster = std::unique_ptr<GeoLib::Raster>(
-		FileIO::AsciiRasterInterface::getRasterFromASCFile(raster_arg.getValue()));
+		GeoLib::IO::AsciiRasterInterface::getRasterFromASCFile(raster_arg.getValue()));
 	GeoLib::RasterHeader header (raster->getHeader());
 	if (refinement_arg.getValue() > 1) {
 		raster->refineRaster(refinement_arg.getValue());
@@ -138,7 +138,7 @@ int main (int argc, char* argv[])
 			                                      raster_arg.getValue()));
 			new_raster_fname += "-" + std::to_string(header.n_rows) + "x" +
 			                    std::to_string(header.n_cols) + ".asc";
-			FileIO::AsciiRasterInterface::writeRasterAsASC(*raster, new_raster_fname);
+			GeoLib::IO::AsciiRasterInterface::writeRasterAsASC(*raster, new_raster_fname);
 		}
 	}
 
diff --git a/GeoLib/IO/AsciiRasterInterface.cpp b/GeoLib/IO/AsciiRasterInterface.cpp
index 0b601206d83..523c6863c7a 100644
--- a/GeoLib/IO/AsciiRasterInterface.cpp
+++ b/GeoLib/IO/AsciiRasterInterface.cpp
@@ -21,7 +21,10 @@
 
 #include "GeoLib/Raster.h"
 
-namespace FileIO {
+namespace GeoLib
+{
+namespace IO
+{
 
 GeoLib::Raster* AsciiRasterInterface::readRaster(std::string const& fname)
 {
@@ -238,7 +241,8 @@ boost::optional<std::vector<GeoLib::Raster const*>> readRasters(
 	std::vector<GeoLib::Raster const*> rasters;
 	rasters.reserve(raster_paths.size());
 	for (auto const& path : raster_paths)
-		rasters.push_back(FileIO::AsciiRasterInterface::readRaster(path));
+		rasters.push_back(GeoLib::IO::AsciiRasterInterface::readRaster(path));
     return boost::make_optional(rasters);
 }
-}
+} // end namespace IO
+} // end namespace GeoLib
diff --git a/GeoLib/IO/AsciiRasterInterface.h b/GeoLib/IO/AsciiRasterInterface.h
index 0e46eebaf26..37058266985 100644
--- a/GeoLib/IO/AsciiRasterInterface.h
+++ b/GeoLib/IO/AsciiRasterInterface.h
@@ -21,8 +21,10 @@
 
 #include "GeoLib/Raster.h"
 
-namespace FileIO {
-
+namespace GeoLib
+{
+namespace IO
+{
 /**
  * Interface for reading and writing a number of ASCII raster formats.
  * Currently supported are reading and writing of Esri asc-files and
@@ -56,6 +58,7 @@ private:
 /// otherwise the returned vector contains pointers to the read rasters.
 boost::optional<std::vector<GeoLib::Raster const*>> readRasters(
     std::vector<std::string> const& raster_paths);
-}
+} // end namespace IO
+} // end namespace GeoLib
 
 #endif /* ASCIIRASTERINTERFACE_H_ */
diff --git a/MeshGeoToolsLib/GeoMapper.cpp b/MeshGeoToolsLib/GeoMapper.cpp
index 00e654d422e..e74f7fba4d1 100644
--- a/MeshGeoToolsLib/GeoMapper.cpp
+++ b/MeshGeoToolsLib/GeoMapper.cpp
@@ -50,7 +50,7 @@ GeoMapper::~GeoMapper()
 
 void GeoMapper::mapOnDEM(const std::string &file_name)
 {
-	_raster = FileIO::AsciiRasterInterface::getRasterFromASCFile(file_name);
+	_raster = GeoLib::IO::AsciiRasterInterface::getRasterFromASCFile(file_name);
 	if (! _raster) {
 		ERR("GeoMapper::mapOnDEM(): failed to load %s", file_name.c_str());
 		return;
-- 
GitLab