diff --git a/GeoLib/StationBorehole.cpp b/GeoLib/StationBorehole.cpp index 6ad0ff30a992400b29a3d9cddc90214bbc8e3f7d..4d75c2c0026ae6f211018ea5906a10cb3053fd0f 100644 --- a/GeoLib/StationBorehole.cpp +++ b/GeoLib/StationBorehole.cpp @@ -29,9 +29,15 @@ namespace GeoLib // The Borehole class // //////////////////////// -StationBorehole::StationBorehole( - double x, double y, double z, double const depth, const std::string& name) - : Station(x, y, z, name, Station::StationType::BOREHOLE), _depth(depth) +StationBorehole::StationBorehole(double x, + double y, + 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 @@ -71,18 +77,14 @@ StationBorehole* StationBorehole::createStation(const std::string& line) fields.pop_front(); auto const depth = strtod( BaseLib::replaceString(",", ".", fields.front()).c_str(), nullptr); - StationBorehole* borehole = new StationBorehole(x, y, z, depth, name); fields.pop_front(); - if (fields.empty()) + int date = 0; + if (! fields.empty()) { - borehole->_date = 0; - } - else - { - borehole->_date = BaseLib::strDate2int(fields.front()); + date = BaseLib::strDate2int(fields.front()); fields.pop_front(); } - return borehole; + return new StationBorehole(x, y, z, depth, name, date); } StationBorehole* StationBorehole::createStation(const std::string& name, @@ -92,12 +94,12 @@ StationBorehole* StationBorehole::createStation(const std::string& name, double depth, const std::string& date) { - StationBorehole* station = new StationBorehole(x, y, z, depth, name); + int integer_date = 0; 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, @@ -120,7 +122,7 @@ void StationBorehole::addSoilLayer(double thickness, // KR - Bode 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()); diff --git a/GeoLib/StationBorehole.h b/GeoLib/StationBorehole.h index 86b66331c1c72b62b0069ce4d83b7d4dc634f51a..34ab026fd3cf6b0734cbbd75247516a5b94c0062 100644 --- a/GeoLib/StationBorehole.h +++ b/GeoLib/StationBorehole.h @@ -36,7 +36,8 @@ public: double y = 0.0, double z = 0.0, double const depth = 0.0, - const std::string& name = ""); + const std::string& name = "", + int date = 0); ~StationBorehole() override; /// Creates a StationBorehole-object from a string (assuming the string has the right format) @@ -48,7 +49,7 @@ public: double y, double z, double depth, - const std::string &date = ""); + const std::string& date = ""); // Returns the depth of the borehole double getDepth() const { return _depth; }