Skip to content
Snippets Groups Projects
Commit daa2ff40 authored by Tom Fischer's avatar Tom Fischer
Browse files

[GL/StationBorehole] Init. date attr. in constructor.

parent 17f9f2c1
No related branches found
No related tags found
No related merge requests found
...@@ -29,9 +29,15 @@ namespace GeoLib ...@@ -29,9 +29,15 @@ namespace GeoLib
// The Borehole class // // The Borehole class //
//////////////////////// ////////////////////////
StationBorehole::StationBorehole( StationBorehole::StationBorehole(double x,
double x, double y, double z, double const depth, const std::string& name) double y,
: Station(x, y, z, name, Station::StationType::BOREHOLE), _depth(depth) double z,
double const depth,
const std::string& name,
int date)
: Station(x, y, z, name, Station::StationType::BOREHOLE),
_depth(depth),
_date(date)
{ {
// add first point of borehole // add first point of borehole
...@@ -71,18 +77,14 @@ StationBorehole* StationBorehole::createStation(const std::string& line) ...@@ -71,18 +77,14 @@ StationBorehole* StationBorehole::createStation(const std::string& line)
fields.pop_front(); fields.pop_front();
auto const depth = strtod( auto const depth = strtod(
BaseLib::replaceString(",", ".", fields.front()).c_str(), nullptr); BaseLib::replaceString(",", ".", fields.front()).c_str(), nullptr);
StationBorehole* borehole = new StationBorehole(x, y, z, depth, name);
fields.pop_front(); fields.pop_front();
if (fields.empty()) int date = 0;
if (! fields.empty())
{ {
borehole->_date = 0; date = BaseLib::strDate2int(fields.front());
}
else
{
borehole->_date = BaseLib::strDate2int(fields.front());
fields.pop_front(); fields.pop_front();
} }
return borehole; return new StationBorehole(x, y, z, depth, name, date);
} }
StationBorehole* StationBorehole::createStation(const std::string& name, StationBorehole* StationBorehole::createStation(const std::string& name,
...@@ -92,12 +94,12 @@ StationBorehole* StationBorehole::createStation(const std::string& name, ...@@ -92,12 +94,12 @@ StationBorehole* StationBorehole::createStation(const std::string& name,
double depth, double depth,
const std::string& date) const std::string& date)
{ {
StationBorehole* station = new StationBorehole(x, y, z, depth, name); int integer_date = 0;
if (date != "0000-00-00") if (date != "0000-00-00")
{ {
station->_date = BaseLib::xmlDate2int(date); integer_date = BaseLib::xmlDate2int(date);
} }
return station; return new StationBorehole(x, y, z, depth, name, integer_date);
} }
void StationBorehole::addSoilLayer(double thickness, void StationBorehole::addSoilLayer(double thickness,
...@@ -120,7 +122,7 @@ void StationBorehole::addSoilLayer(double thickness, ...@@ -120,7 +122,7 @@ void StationBorehole::addSoilLayer(double thickness,
// KR - Bode // KR - Bode
if (_profilePntVec.empty()) if (_profilePntVec.empty())
{ {
addSoilLayer((*this)[0], (*this)[1], (*this)[2], ""); addSoilLayer((*this)[0], (*this)[1], (*this)[2], soil_name);
} }
std::size_t idx(_profilePntVec.size()); std::size_t idx(_profilePntVec.size());
......
...@@ -36,7 +36,8 @@ public: ...@@ -36,7 +36,8 @@ public:
double y = 0.0, double y = 0.0,
double z = 0.0, double z = 0.0,
double const depth = 0.0, double const depth = 0.0,
const std::string& name = ""); const std::string& name = "",
int date = 0);
~StationBorehole() override; ~StationBorehole() override;
/// Creates a StationBorehole-object from a string (assuming the string has the right format) /// Creates a StationBorehole-object from a string (assuming the string has the right format)
...@@ -48,7 +49,7 @@ public: ...@@ -48,7 +49,7 @@ public:
double y, double y,
double z, double z,
double depth, double depth,
const std::string &date = ""); const std::string& date = "");
// Returns the depth of the borehole // Returns the depth of the borehole
double getDepth() const { return _depth; } double getDepth() const { return _depth; }
......
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