OGS
GeoLib::Station Class Reference

Detailed Description

A Station (observation site) is basically a Point with some additional information.

Additional information is largely optional (except for a name, but even this may be empty). It may include a name, a stratigraphy (only for the derived class StationBore), time series data from data loggers (as a SensorData-object), etc.

See also
StationBorehole, SensorData

Definition at line 36 of file Station.h.

#include <Station.h>

Inheritance diagram for GeoLib::Station:
[legend]
Collaboration diagram for GeoLib::Station:
[legend]

Public Member Functions

 Station (double x=0.0, double y=0.0, double z=0.0, std::string name="")
 Constructor.
 
 Station (Point const *coords, std::string name="")
 
 Station (Station const &src)
 
std::string const & getName () const
 Returns the name of the station.
 
void setName (std::string const &name)
 
double getStationValue () const
 Returns the specific value for this station.
 
void setStationValue (double station_value)
 
void addSensorDataFromCSV (const std::string &file_name)
 Allows to add sensor data from a CSV file to the observation site.
 
const SensorDatagetSensorData () const
 Returns all the sensor data for this observation site.
 
- Public Member Functions inherited from GeoLib::Point
 Point ()=default
 
 Point (double x1, double x2, double x3, std::size_t id=std::numeric_limits< std::size_t >::max())
 
 Point (MathLib::Point3d const &x, std::size_t id)
 
 Point (std::array< double, 3 > const &x, std::size_t id=std::numeric_limits< std::size_t >::max())
 
GEOTYPE getGeoType () const override
 return a geometry type
 
- Public Member Functions inherited from MathLib::Point3dWithID
 Point3dWithID (double x0, double x1, double x2, std::size_t id=std::numeric_limits< std::size_t >::max())
 
 Point3dWithID (std::array< double, 3 > const &coords, std::size_t id=std::numeric_limits< std::size_t >::max())
 
 Point3dWithID (MathLib::Point3d const &pnt, std::size_t id=std::numeric_limits< std::size_t >::max())
 
 Point3dWithID ()
 
std::size_t getID () const
 
- Public Member Functions inherited from MathLib::Point3d
 Point3d ()
 
 Point3d (std::array< double, 3 > x)
 
virtual ~Point3d ()=default
 
 Point3d (Point3d const &)=default
 
Point3doperator= (Point3d const &)=default
 
const double & operator[] (std::size_t idx) const
 const access operator The access to the point coordinates is like the access to a field. Code example:
 
double & operator[] (std::size_t idx)
 access operator (see book Effektiv C++ programmieren - subsection 1.3.2 ).
 
const double * data () const
 
double * data ()
 
Eigen::Vector3d const & asEigenVector3d () const
 
Eigen::Vector3d & asEigenVector3d ()
 
- Public Member Functions inherited from GeoLib::GeoObject
virtual ~GeoObject ()=default
 

Static Public Member Functions

static StationcreateStation (const std::string &line)
 
static StationcreateStation (const std::string &name, double x, double y, double z)
 Creates a new station object based on the given parameters.
 

Private Attributes

std::string _name
 
double _station_value {0.0}
 
std::unique_ptr< SensorData_sensor_data {nullptr}
 

Additional Inherited Members

- Protected Member Functions inherited from MathLib::Point3dWithID
void setID (std::size_t id)
 Sets the ID of a node to the given value.
 
- Protected Attributes inherited from GeoLib::Point
friend PointVec
 

Constructor & Destructor Documentation

◆ Station() [1/3]

GeoLib::Station::Station ( double x = 0.0,
double y = 0.0,
double z = 0.0,
std::string name = "" )
explicit

Constructor.

Constructor initialising a Station object

Parameters
xThe x-coordinate of the station.
yThe y-coordinate of the station.
zThe z-coordinate of the station.
nameThe name of the station.

Definition at line 25 of file Station.cpp.

27 : Point(x, y, z), _name(std::move(name))
28{
29}
Point()=default
std::string _name
Definition Station.h:92

Referenced by createStation(), and createStation().

◆ Station() [2/3]

GeoLib::Station::Station ( Point const * coords,
std::string name = "" )
explicit

Definition at line 31 of file Station.cpp.

32 : Point(*coords), _name(std::move(name))
33{
34}

◆ Station() [3/3]

GeoLib::Station::Station ( Station const & src)

Constructor copies the source object

Parameters
srcthe Station object that should be copied

Definition at line 36 of file Station.cpp.

37 : Point(src),
38 _name(src._name),
39 _station_value(src._station_value),
40 _sensor_data(src._sensor_data.get() != nullptr
41 ? new SensorData(*(src._sensor_data.get()))
42 : nullptr)
43{
44}
double _station_value
Definition Station.h:93
std::unique_ptr< SensorData > _sensor_data
Definition Station.h:94
A container for sensor data at an observation site. The class stores a number of time series and has ...
Definition SensorData.h:63

Member Function Documentation

◆ addSensorDataFromCSV()

void GeoLib::Station::addSensorDataFromCSV ( const std::string & file_name)
inline

Allows to add sensor data from a CSV file to the observation site.

Definition at line 83 of file Station.h.

84 {
85 _sensor_data.reset(new SensorData(file_name));
86 }

References _sensor_data.

Referenced by GeoLib::IO::XmlStnInterface::readStations().

◆ createStation() [1/2]

Station * GeoLib::Station::createStation ( const std::string & line)
static

Creates a Station-object from information contained in a string (assuming the string has the right format)

Definition at line 46 of file Station.cpp.

47{
48 std::list<std::string> fields = BaseLib::splitString(line, '\t');
49
50 if (fields.size() < 3)
51 {
52 INFO("Station::createStation() - Unexpected file format.");
53 return nullptr;
54 }
55
56 auto it = fields.begin();
57 std::string name = *it;
58 auto const x = std::strtod(
59 (BaseLib::replaceString(",", ".", *(++it))).c_str(), nullptr);
60 auto const y = std::strtod(
61 (BaseLib::replaceString(",", ".", *(++it))).c_str(), nullptr);
62 auto z = 0.0;
63 if (++it != fields.end())
64 {
65 z = std::strtod((BaseLib::replaceString(",", ".", *it)).c_str(),
66 nullptr);
67 }
68 return new Station(x, y, z, name);
69}
void INFO(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:35
Station(double x=0.0, double y=0.0, double z=0.0, std::string name="")
Constructor.
Definition Station.cpp:25
std::string replaceString(const std::string &searchString, const std::string &replaceString, std::string stringToReplace)
std::vector< std::string > splitString(std::string const &str)

References Station(), INFO(), BaseLib::replaceString(), and BaseLib::splitString().

Referenced by convertPoints(), and FileIO::SHPInterface::readStations().

◆ createStation() [2/2]

Station * GeoLib::Station::createStation ( const std::string & name,
double x,
double y,
double z )
static

Creates a new station object based on the given parameters.

Definition at line 71 of file Station.cpp.

73{
74 return new Station(x, y, z, name);
75}

References Station().

◆ getName()

std::string const & GeoLib::Station::getName ( ) const
inline

Returns the name of the station.

Definition at line 60 of file Station.h.

60{ return _name; }

References _name.

Referenced by DiagramPrefsDialog::DiagramPrefsDialog(), DiagramPrefsDialog::DiagramPrefsDialog(), StratScene::StratScene(), and GeoLib::IO::XmlStnInterface::readStratigraphy().

◆ getSensorData()

const SensorData * GeoLib::Station::getSensorData ( ) const
inline

Returns all the sensor data for this observation site.

Definition at line 89 of file Station.h.

89{ return _sensor_data.get(); }

References _sensor_data.

Referenced by DiagramPrefsDialog::DiagramPrefsDialog(), and MainWindow::showDiagramPrefsDialog().

◆ getStationValue()

double GeoLib::Station::getStationValue ( ) const
inline

Returns the specific value for this station.

Definition at line 73 of file Station.h.

73{ return this->_station_value; }

References _station_value.

Referenced by VtkStationSource::RequestData().

◆ setName()

void GeoLib::Station::setName ( std::string const & name)
inline

Definition at line 62 of file Station.h.

62{ _name = name; }

References _name.

◆ setStationValue()

void GeoLib::Station::setStationValue ( double station_value)
inline

Allows to set a specific value for this station (e.g. for classification)

Definition at line 77 of file Station.h.

78 {
79 this->_station_value = station_value;
80 }

References _station_value.

Referenced by GeoLib::IO::XmlStnInterface::readStations().

Member Data Documentation

◆ _name

std::string GeoLib::Station::_name
private

Definition at line 92 of file Station.h.

Referenced by getName(), and setName().

◆ _sensor_data

std::unique_ptr<SensorData> GeoLib::Station::_sensor_data {nullptr}
private

Definition at line 94 of file Station.h.

94{nullptr};

Referenced by addSensorDataFromCSV(), and getSensorData().

◆ _station_value

double GeoLib::Station::_station_value {0.0}
private

Definition at line 93 of file Station.h.

93{0.0};

Referenced by getStationValue(), and setStationValue().


The documentation for this class was generated from the following files: