Skip to content
Snippets Groups Projects
Commit d1e3e96d authored by Karsten Rink's avatar Karsten Rink
Browse files

added missing sensordata-part in stn-reader, fixed missing library reference in cmakefile

parent c7c7fb76
No related branches found
No related tags found
No related merge requests found
...@@ -95,19 +95,24 @@ void XmlStnInterface::readStations( const QDomNode &stationsRoot, ...@@ -95,19 +95,24 @@ void XmlStnInterface::readStations( const QDomNode &stationsRoot,
station.hasAttribute("y")) station.hasAttribute("y"))
{ {
std::string stationName("[NN]"); std::string stationName("[NN]");
std::string sensor_data_file_name("");
std::string boreholeDate("0000-00-00"); std::string boreholeDate("0000-00-00");
double boreholeDepth(0.0), stationValue(0.0); double boreholeDepth(0.0), stationValue(0.0);
QDomNodeList stationFeatures = station.childNodes(); QDomNodeList stationFeatures = station.childNodes();
for(int i = 0; i < stationFeatures.count(); i++) for(int i = 0; i < stationFeatures.count(); i++)
{ {
// check for general station features
const QDomNode feature_node (stationFeatures.at(i)); const QDomNode feature_node (stationFeatures.at(i));
const QString feature_name (feature_node.nodeName()); const QString feature_name (feature_node.nodeName());
const std::string element_text (feature_node.toElement().text().toStdString()); const std::string element_text (feature_node.toElement().text().toStdString());
if (feature_name.compare("name") == 0) if (feature_name.compare("name") == 0)
stationName = feature_node.toElement().text().toStdString(); 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 */ /* add other station features here */
// check for general borehole features
else if (feature_name.compare("value") == 0) else if (feature_name.compare("value") == 0)
stationValue = strtod(element_text.c_str(), 0); stationValue = strtod(element_text.c_str(), 0);
else if (feature_name.compare("bdepth") == 0) else if (feature_name.compare("bdepth") == 0)
...@@ -117,10 +122,7 @@ void XmlStnInterface::readStations( const QDomNode &stationsRoot, ...@@ -117,10 +122,7 @@ void XmlStnInterface::readStations( const QDomNode &stationsRoot,
/* add other borehole features here */ /* add other borehole features here */
} }
double zVal = (station.hasAttribute("z")) ? strtod((station.attribute( double zVal = (station.hasAttribute("z")) ? strtod((station.attribute("z")).toStdString().c_str(), 0) : 0.0;
"z")).
toStdString().c_str(),
0) : 0.0;
if (station.nodeName().compare("station") == 0) if (station.nodeName().compare("station") == 0)
{ {
...@@ -128,9 +130,11 @@ void XmlStnInterface::readStations( const QDomNode &stationsRoot, ...@@ -128,9 +130,11 @@ void XmlStnInterface::readStations( const QDomNode &stationsRoot,
new GeoLib::Station( new GeoLib::Station(
strtod((station.attribute("x")).toStdString().c_str(), 0), strtod((station.attribute("x")).toStdString().c_str(), 0),
strtod((station.attribute("y")).toStdString().c_str(), 0), strtod((station.attribute("y")).toStdString().c_str(), 0),
zVal, zVal,
stationName); stationName);
s->setStationValue(stationValue); s->setStationValue(stationValue);
if (!sensor_data_file_name.empty())
s->addSensorDataFromCSV(BaseLib::copyPathToFileName(sensor_data_file_name, station_file_name));
stations->push_back(s); stations->push_back(s);
} }
else if (station.nodeName().compare("borehole") == 0) else if (station.nodeName().compare("borehole") == 0)
...@@ -144,17 +148,15 @@ void XmlStnInterface::readStations( const QDomNode &stationsRoot, ...@@ -144,17 +148,15 @@ void XmlStnInterface::readStations( const QDomNode &stationsRoot,
boreholeDate); boreholeDate);
s->setStationValue(stationValue); s->setStationValue(stationValue);
/* add stratigraphy to the borehole */ /* add stratigraphy to the borehole */
for(int i = 0; i < stationFeatures.count(); i++) for(int j = 0; j < stationFeatures.count(); j++)
if (stationFeatures.at(i).nodeName().compare("strat") == 0) if (stationFeatures.at(j).nodeName().compare("strat") == 0)
this->readStratigraphy(stationFeatures.at(i), s); this->readStratigraphy(stationFeatures.at(j), s);
stations->push_back(s); stations->push_back(s);
} }
} }
else else
std::cout << std::cout << "XmlStnInterface::readStations() - Attribute missing in <station> tag ..." << std::endl;
"XmlStnInterface::readStations() - Attribute missing in <station> tag ..." <<
std::endl;
station = station.nextSiblingElement(); station = station.nextSiblingElement();
} }
} }
......
IF (WIN32)
SET ( ADDITIONAL_LIBS Winmm.lib )
ENDIF()
INCLUDE_DIRECTORIES( INCLUDE_DIRECTORIES(
. .
...@@ -23,6 +26,7 @@ TARGET_LINK_LIBRARIES ( MeshRead ...@@ -23,6 +26,7 @@ TARGET_LINK_LIBRARIES ( MeshRead
BaseLib BaseLib
GeoLib GeoLib
logog logog
${ADDITIONAL_LIBS}
) )
# Create CollapseMeshNodes executable # Create CollapseMeshNodes executable
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment