From d1e3e96d1d12051414a76de366d10b3512ba68a4 Mon Sep 17 00:00:00 2001
From: Karsten Rink <karsten.rink@ufz.de>
Date: Fri, 10 Aug 2012 12:14:34 +0200
Subject: [PATCH] added missing sensordata-part in stn-reader, fixed missing
 library reference in cmakefile

---
 FileIO/XmlIO/XmlStnInterface.cpp     | 24 +++++++++++++-----------
 SimpleTests/MeshTests/CMakeLists.txt |  4 ++++
 2 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/FileIO/XmlIO/XmlStnInterface.cpp b/FileIO/XmlIO/XmlStnInterface.cpp
index 09995cb64f1..317d9b44f77 100644
--- a/FileIO/XmlIO/XmlStnInterface.cpp
+++ b/FileIO/XmlIO/XmlStnInterface.cpp
@@ -95,19 +95,24 @@ void XmlStnInterface::readStations( const QDomNode &stationsRoot,
 		    station.hasAttribute("y"))
 		{
 			std::string stationName("[NN]");
+			std::string sensor_data_file_name("");
 			std::string boreholeDate("0000-00-00");
 			double boreholeDepth(0.0), stationValue(0.0);
 
 			QDomNodeList stationFeatures = station.childNodes();
 			for(int i = 0; i < stationFeatures.count(); i++)
 			{
+				// check for general station features
 				const QDomNode feature_node (stationFeatures.at(i));
 				const QString feature_name (feature_node.nodeName());
 				const std::string element_text (feature_node.toElement().text().toStdString());
 				if (feature_name.compare("name") == 0)
 					stationName = feature_node.toElement().text().toStdString();
+				if (feature_name.compare("sensordata") == 0)
+					sensor_data_file_name = feature_node.toElement().text().toStdString();
 				/* add other station features here */
 
+				// check for general borehole features
 				else if (feature_name.compare("value") == 0)
 					stationValue = strtod(element_text.c_str(), 0);
 				else if (feature_name.compare("bdepth") == 0)
@@ -117,10 +122,7 @@ void XmlStnInterface::readStations( const QDomNode &stationsRoot,
 				/* add other borehole features here */
 			}
 
-			double zVal = (station.hasAttribute("z")) ? strtod((station.attribute(
-			                                                            "z")).
-			                                                   toStdString().c_str(),
-			                                                   0) : 0.0;
+			double zVal = (station.hasAttribute("z")) ? strtod((station.attribute("z")).toStdString().c_str(), 0) : 0.0;
 
 			if (station.nodeName().compare("station") == 0)
 			{
@@ -128,9 +130,11 @@ void XmlStnInterface::readStations( const QDomNode &stationsRoot,
 				        new GeoLib::Station(
 							strtod((station.attribute("x")).toStdString().c_str(), 0),
 				            strtod((station.attribute("y")).toStdString().c_str(), 0),
-				            zVal,
+				            zVal, 
 							stationName);
 				s->setStationValue(stationValue);
+				if (!sensor_data_file_name.empty())
+						s->addSensorDataFromCSV(BaseLib::copyPathToFileName(sensor_data_file_name, station_file_name));
 				stations->push_back(s);
 			}
 			else if (station.nodeName().compare("borehole") == 0)
@@ -144,17 +148,15 @@ void XmlStnInterface::readStations( const QDomNode &stationsRoot,
 				        boreholeDate);
 				s->setStationValue(stationValue);
 				/* add stratigraphy to the borehole */
-				for(int i = 0; i < stationFeatures.count(); i++)
-					if (stationFeatures.at(i).nodeName().compare("strat") == 0)
-						this->readStratigraphy(stationFeatures.at(i), s);
+				for(int j = 0; j < stationFeatures.count(); j++)
+					if (stationFeatures.at(j).nodeName().compare("strat") == 0)
+						this->readStratigraphy(stationFeatures.at(j), s);
 
 				stations->push_back(s);
 			}
 		}
 		else
-			std::cout <<
-			"XmlStnInterface::readStations() - Attribute missing in <station> tag ..." <<
-			std::endl;
+			std::cout << "XmlStnInterface::readStations() - Attribute missing in <station> tag ..." << std::endl;
 		station = station.nextSiblingElement();
 	}
 }
diff --git a/SimpleTests/MeshTests/CMakeLists.txt b/SimpleTests/MeshTests/CMakeLists.txt
index 1dcf599294e..7640be288b8 100644
--- a/SimpleTests/MeshTests/CMakeLists.txt
+++ b/SimpleTests/MeshTests/CMakeLists.txt
@@ -1,3 +1,6 @@
+IF (WIN32)
+	SET ( ADDITIONAL_LIBS Winmm.lib )
+ENDIF()
 
 INCLUDE_DIRECTORIES(
         .
@@ -23,6 +26,7 @@ TARGET_LINK_LIBRARIES ( MeshRead
 	BaseLib
 	GeoLib
 	logog
+	${ADDITIONAL_LIBS}
 )
 
 # Create CollapseMeshNodes executable
-- 
GitLab