From ebda002856060563ab4a52b149c09f5f4630173c Mon Sep 17 00:00:00 2001
From: Karsten Rink <karsten.rink@ufz.de>
Date: Fri, 11 Jan 2013 16:54:36 +0100
Subject: [PATCH] fixed issue #26 ; fixed problem with CMAKE not finding
 VTK_DIR if other small libraries are build at the same time.

---
 FileIO/Legacy/MeshIO.cpp                | 6 +++---
 FileIO/RapidXmlIO/BoostVtuInterface.cpp | 9 +++++++--
 Gui/DataView/GeoMapper.cpp              | 2 +-
 scripts/cmake/Find.cmake                | 4 ++--
 4 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/FileIO/Legacy/MeshIO.cpp b/FileIO/Legacy/MeshIO.cpp
index 70c839f3695..595b95ac3eb 100644
--- a/FileIO/Legacy/MeshIO.cpp
+++ b/FileIO/Legacy/MeshIO.cpp
@@ -44,7 +44,7 @@ MeshIO::MeshIO()
 
 MeshLib::Mesh* MeshIO::loadMeshFromFile(const std::string& file_name)
 {
-	INFO("MeshIO::loadMeshFromFile(): Reading OGS legacy mesh ... ");
+	INFO("Reading OGS legacy mesh ... ");
 
 	std::ifstream in (file_name.c_str(),std::ios::in);
 	if (!in.is_open())
@@ -120,7 +120,7 @@ MeshLib::Mesh* MeshIO::loadMeshFromFile(const std::string& file_name)
 		                                               file_name), nodes, elements));
 		mesh->setEdgeLengthRange(sqrt(edge_length[0]), sqrt(edge_length[1]));
 
-		INFO("\tMeshIO::loadMeshFromFile(): finished.");
+		INFO("\t... finished.");
 		INFO("Nr. Nodes: %d.", nodes.size());
 		INFO("Nr. Elements: %d.", elements.size());
 
@@ -231,7 +231,7 @@ MeshLib::Element* MeshIO::readElement(const std::string& line,
 int MeshIO::write(std::ostream &out)
 {
 	if(!_mesh) {
-		WARN("MeshIO::write(): Cannot write: no mesh set!");
+		WARN("MeshIO::write(): Cannot write: no mesh object specified.");
 		return 0;
 	}
 
diff --git a/FileIO/RapidXmlIO/BoostVtuInterface.cpp b/FileIO/RapidXmlIO/BoostVtuInterface.cpp
index e3d69f2681d..ae19f4d7f5d 100644
--- a/FileIO/RapidXmlIO/BoostVtuInterface.cpp
+++ b/FileIO/RapidXmlIO/BoostVtuInterface.cpp
@@ -12,6 +12,7 @@
  */
 
 #include "BoostVtuInterface.h"
+#include "zLibDataCompressor.h"
 #include <fstream>
 
 #include <boost/foreach.hpp>
@@ -359,8 +360,12 @@ bool BoostVtuInterface::isVTKUnstructuredGrid(const property_tree::ptree &vtk_ro
 
 unsigned char* BoostVtuInterface::uncompressData(property_tree::ptree const& compressed_data_node)
 {
-	const char* compressed_data = compressed_data_node.data().c_str();
-	return nullptr;
+	const unsigned char* compressed_data = reinterpret_cast<const unsigned char*>(compressed_data_node.data().c_str());
+	unsigned long compressed_size = strlen(compressed_data_node.data().c_str());
+	unsigned char* uncompressed_data;
+	unsigned long uncompressed_size = 0;
+	unsigned long result = zLibDataCompressor::UncompressBuffer(compressed_data, compressed_size, uncompressed_data, uncompressed_size);
+	return uncompressed_data;
 }
 
 const optional<std::string> BoostVtuInterface::getXmlAttribute(std::string const& key,
diff --git a/Gui/DataView/GeoMapper.cpp b/Gui/DataView/GeoMapper.cpp
index 3495da96dc6..a382a68e560 100644
--- a/Gui/DataView/GeoMapper.cpp
+++ b/Gui/DataView/GeoMapper.cpp
@@ -140,7 +140,7 @@ GeoLib::Grid<GeoLib::PointWithID>* GeoMapper::getFlatGrid(MeshLib::Mesh const*co
 	}
 	else
 	{
-		double dir[3] = {1,0,0};
+		double dir[3] = {0,0,1};
 		sfc_pnts = MeshLib::MshEditor::getSurfaceNodes(*mesh, dir);
 	}
 	size_t nPoints (sfc_pnts.size());
diff --git a/scripts/cmake/Find.cmake b/scripts/cmake/Find.cmake
index c23fed3615f..cc583ed05db 100644
--- a/scripts/cmake/Find.cmake
+++ b/scripts/cmake/Find.cmake
@@ -4,7 +4,7 @@
 
 # Compiled libraries (for Windows)
 FIND_PATH(OGS_LIBS_DIR_FOUND geotiff.lib
-	PATHS $ENV{OGS_LIBS} ${OGS_LIBS_DIR} ${PROJECT_SOURCE_DIR}/../Libs C:/OGS_Libs
+	PATHS $ENV{OGS_LIBS} ${OGS_LIBS_DIR} ${PROJECT_SOURCE_DIR}/../libs C:/OGS_Libs
 	PATH_SUFFIXES libgeotiff)
 IF(OGS_LIBS_DIR_FOUND)
 	SET(OGS_LIBS_DIR ${OGS_LIBS_DIR_FOUND}/..)
@@ -104,7 +104,7 @@ ENDIF (CMAKE_USE_PTHREADS_INIT )
 FIND_PACKAGE ( LAPACK QUIET )
 
 ## VTK ##
-IF (OGS_LIBS_DIR_FOUND)
+IF (OGS_LIBS_DIR_FOUND AND NOT VTK_DIR)
 	SET (VTK_DIR ${OGS_LIBS_DIR}/VTK/build)
 ENDIF () # OGS_LIBS_DIR_FOUND
 IF(NOT OGS_DONT_USE_VTK)
-- 
GitLab