OGS
GeoLib::GEOObjects Class Referencefinal

Detailed Description

Container class for geometric objects.

This class contains all the methods necessary for the I/O of geometric objects. Said objects are Points, polylines, Surfaces and Stations and they are stored in vectors (arrays) which are identified by a unique name. For a hierarchical definition, surfaces are bounded by polylines and polylines are defined by points. Therefore, a vector of surfaces references a vector polylines and a vector of polylines references a vector of points, respectively. For identification purposes, all of these vectors have the same name, i.e. the polyline- vector named "aaa" references a point vector "aaa". However, this name ("aaa") is unique among all the vectors of the same class, i.e. there exists only one point- vector with this name, etc. Note: The fact that vectors are uniquely named and the same name is assigned to related objects is automatically handled by this class.

For each of these object-classes exists an "add", "remove" and "get"-method which allows for loading/unloading as well as accessing the data, respectively. E.g. for points these methods are "addPointVec(name)", "getPointVec(name)" and "removePointVec(name)". For some objects, additional methods might exist if necessary.

Definition at line 60 of file GEOObjects.h.

#include <GEOObjects.h>

Classes

struct  Callbacks
 

Public Member Functions

void addPointVec (std::unique_ptr< std::vector< Point * >> points, std::string &name, std::unique_ptr< std::map< std::string, std::size_t >> pnt_id_name_map=nullptr, double eps=std::sqrt(std::numeric_limits< double >::epsilon()))
 
const std::vector< Point * > * getPointVec (const std::string &name) const
 
const PointVecgetPointVecObj (const std::string &name) const
 
PointVecgetPointVecObj (const std::string &name)
 Returns a pointer to a PointVec object for the given name. More...
 
bool removePointVec (const std::string &name)
 
void addStationVec (std::unique_ptr< std::vector< Point * >> stations, std::string &name)
 Adds a vector of stations with the given name and colour to GEOObjects. More...
 
const std::vector< GeoLib::Point * > * getStationVec (const std::string &name) const
 Returns the station vector with the given name. More...
 
bool removeStationVec (const std::string &name)
 Removes the station vector with the given name from GEOObjects. More...
 
void addPolylineVec (std::unique_ptr< std::vector< Polyline * >> lines, const std::string &name, std::unique_ptr< std::map< std::string, std::size_t >> ply_names=nullptr)
 
bool appendPolylineVec (const std::vector< Polyline * > &polylines, const std::string &name)
 
const std::vector< Polyline * > * getPolylineVec (const std::string &name) const
 
const PolylineVecgetPolylineVecObj (const std::string &name) const
 
PolylineVecgetPolylineVecObj (const std::string &name)
 Returns a pointer to a PolylineVec object for the given name. More...
 
bool removePolylineVec (const std::string &name)
 
void addSurfaceVec (std::unique_ptr< std::vector< Surface * >> sfc, const std::string &name, std::unique_ptr< std::map< std::string, std::size_t >> sfc_names=nullptr)
 
bool appendSurfaceVec (const std::vector< Surface * > &surfaces, const std::string &name)
 
const std::vector< Surface * > * getSurfaceVec (const std::string &name) const
 Returns the surface vector with the given name as a const. More...
 
SurfaceVecgetSurfaceVecObj (const std::string &name)
 Returns the surface vector with the given name. More...
 
bool removeSurfaceVec (const std::string &name)
 
const SurfaceVecgetSurfaceVecObj (const std::string &name) const
 
std::vector< std::string > getGeometryNames () const
 Returns the names of all geometry vectors. More...
 
std::string getElementNameByID (const std::string &geometry_name, GeoLib::GEOTYPE type, std::size_t id) const
 
void getStationVectorNames (std::vector< std::string > &names) const
 Returns the names of all station vectors. More...
 
bool isUniquePointVecName (std::string &name) const
 
int mergeGeometries (std::vector< std::string > const &geo_names, std::string &merged_geo_name)
 
void renameGeometry (std::string const &old_name, std::string const &new_name)
 
const GeoLib::GeoObjectgetGeoObject (const std::string &geo_name, GeoLib::GEOTYPE type, const std::string &geo_obj_name) const
 Returns the geo object for a geometric item of the given name and type for the associated geometry. More...
 
GeoLib::GeoObject const * getGeoObject (const std::string &geo_name, const std::string &geo_obj_name) const
 Return named (by the tuple geo_name and geo_obj_name) geo object. More...
 
 GEOObjects ()
 
 ~GEOObjects ()
 
std::size_t exists (const std::string &geometry_name) const
 
bool isPntVecUsed (const std::string &name) const
 Checks if the point vector with the given name is referenced in a polyline- or surface vector. More...
 
std::vector< PointVec * > const & getPoints () const
 Read access to points w/o using a name. More...
 
std::vector< PolylineVec * > const & getPolylines () const
 Read access to polylines w/o using a name. More...
 
std::vector< SurfaceVec * > const & getSurfaces () const
 Read access to surfaces w/o using a name. More...
 

Public Attributes

std::vector< PointVec * > _pnt_vecs
 
std::vector< PolylineVec * > _ply_vecs
 
std::vector< SurfaceVec * > _sfc_vecs
 
std::unique_ptr< Callbacks_callbacks {new Callbacks}
 
std::function< void(std::string const &)> addPolylineVecCallback
 
std::function< void(std::string const &)> appendPolylineVecCallback
 
std::function< void(std::string const &)> removePolylineVecCallback
 
std::function< void(std::string const &)> addSurfaceVecCallback
 
std::function< void(std::string const &)> appendSurfaceVecCallback
 
std::function< void(std::string const &)> removeSurfaceVecCallback
 

Private Member Functions

bool mergePoints (std::vector< std::string > const &geo_names, std::string &merged_geo_name, std::vector< std::size_t > &pnt_offsets)
 
void mergePolylines (std::vector< std::string > const &geo_names, std::string const &merged_geo_name, std::vector< std::size_t > const &pnt_offsets)
 
void mergeSurfaces (std::vector< std::string > const &geo_names, std::string const &merged_geo_name, std::vector< std::size_t > const &pnt_offsets)
 

Constructor & Destructor Documentation

◆ GEOObjects()

GeoLib::GEOObjects::GEOObjects ( )
default

constructor

◆ ~GEOObjects()

GeoLib::GEOObjects::~GEOObjects ( )

destructor

Definition at line 32 of file GEOObjects.cpp.

33 {
34  // delete surfaces
35  for (auto& surface : _sfc_vecs)
36  {
37  delete surface;
38  }
39  // delete polylines
40  for (auto& polyline : _ply_vecs)
41  {
42  delete polyline;
43  }
44  // delete points
45  for (auto& point : _pnt_vecs)
46  {
47  delete point;
48  }
49 }
std::vector< PointVec * > _pnt_vecs
Definition: GEOObjects.h:295
std::vector< PolylineVec * > _ply_vecs
Definition: GEOObjects.h:298
std::vector< SurfaceVec * > _sfc_vecs
Definition: GEOObjects.h:300

References _ply_vecs, _pnt_vecs, and _sfc_vecs.

Member Function Documentation

◆ addPointVec()

void GeoLib::GEOObjects::addPointVec ( std::unique_ptr< std::vector< Point * >>  points,
std::string &  name,
std::unique_ptr< std::map< std::string, std::size_t >>  pnt_id_name_map = nullptr,
double  eps = std::sqrt(std::numeric_limits<double>::epsilon()) 
)

Adds a vector of points with the given name to GEOObjects.

Parameters
pointsvector of pointers to points
namethe project name
pnt_id_name_mapnames corresponding to the points
epsrelative tolerance value for testing of point uniqueness

Definition at line 51 of file GEOObjects.cpp.

56 {
58  if (!points || points->empty())
59  {
60  DBUG(
61  "GEOObjects::addPointVec(): Failed to create PointVec, because "
62  "there aren't any points in the given vector.");
63  return;
64  }
65  _pnt_vecs.push_back(new PointVec(name, std::move(points),
66  std::move(pnt_id_name_map),
68  _callbacks->addPointVec(name);
69 }
void DBUG(char const *fmt, Args const &... args)
Definition: Logging.h:27
bool isUniquePointVecName(std::string &name) const
Definition: GEOObjects.cpp:339
std::unique_ptr< Callbacks > _callbacks
Definition: GEOObjects.h:302

References _callbacks, _pnt_vecs, DBUG(), isUniquePointVecName(), MaterialPropertyLib::name, and GeoLib::PointVec::POINT.

Referenced by FileIO::PetrelInterface::PetrelInterface(), convertMeshNodesToGeometry(), anonymous_namespace{convertMeshToGeo.cpp}::convertMeshNodesToGeoPoints(), convertPoints(), FileIO::SwmmInterface::convertSwmmInputToGeometry(), createGeometries(), GeoLib::Grid< POINT >::createGridGeometry(), GeoLib::DuplicateGeometry::duplicate(), main(), mergeGeometries(), mergePoints(), FileIO::FEFLOWGeoInterface::readFEFLOWFile(), GeoLib::IO::XmlGmlInterface::readFile(), GeoLib::IO::BoostXmlGmlInterface::readFile(), FileIO::Legacy::readGLIFileV4(), FileIO::SHPInterface::readPoints(), FileIO::SHPInterface::readPolylines(), FileIO::TetGenInterface::readTetGenGeometry(), and FileIO::GMSH::GMSHPolygonTree::writeAdditionalPointData().

◆ addPolylineVec()

void GeoLib::GEOObjects::addPolylineVec ( std::unique_ptr< std::vector< Polyline * >>  lines,
const std::string &  name,
std::unique_ptr< std::map< std::string, std::size_t >>  ply_names = nullptr 
)

Adds a vector of polylines with the given name to GEOObjects.

Parameters
linesThe lines vector.
nameThe geometry to which the given Polyline objects should be added.
ply_namesmap of names and ids that are corresponding to the polylines

Definition at line 150 of file GEOObjects.cpp.

155 {
156  assert(lines);
157  auto lines_end = std::remove_if(
158  lines->begin(), lines->end(),
159  [](auto const* polyline) { return polyline->getNumberOfPoints() < 2; });
160  lines->erase(lines_end, lines->end());
161 
162  if (lines->empty())
163  {
164  return;
165  }
166 
167  _ply_vecs.push_back(
168  new PolylineVec(name, std::move(lines), std::move(ply_names)));
169  _callbacks->addPolylineVec(name);
170 }
TemplateVec< GeoLib::Polyline > PolylineVec
class PolylineVec encapsulate a std::vector of Polylines additional one can give the vector of polyli...
Definition: PolylineVec.h:29

References _callbacks, _ply_vecs, and MaterialPropertyLib::name.

Referenced by FileIO::PetrelInterface::PetrelInterface(), FileIO::SwmmInterface::convertSwmmInputToGeometry(), createGeometries(), GeoLib::Grid< POINT >::createGridGeometry(), GeoLib::DuplicateGeometry::duplicate(), mergeGeometries(), mergePolylines(), FileIO::FEFLOWGeoInterface::readFEFLOWFile(), GeoLib::IO::XmlGmlInterface::readFile(), GeoLib::IO::BoostXmlGmlInterface::readFile(), FileIO::Legacy::readGLIFileV4(), FileIO::SHPInterface::readPolylines(), and FileIO::GMSH::GMSHPolygonTree::writeAdditionalPointData().

◆ addStationVec()

void GeoLib::GEOObjects::addStationVec ( std::unique_ptr< std::vector< Point * >>  stations,
std::string &  name 
)

◆ addSurfaceVec()

void GeoLib::GEOObjects::addSurfaceVec ( std::unique_ptr< std::vector< Surface * >>  sfc,
const std::string &  name,
std::unique_ptr< std::map< std::string, std::size_t >>  sfc_names = nullptr 
)

Adds a vector of surfaces with the given name to GEOObjects.

Definition at line 244 of file GEOObjects.cpp.

249 {
250  _sfc_vecs.push_back(
251  new SurfaceVec(name, std::move(sfc), std::move(sfc_names)));
252  _callbacks->addSurfaceVec(name);
253 }
TemplateVec< GeoLib::Surface > SurfaceVec
Definition: SurfaceVec.h:27

References _callbacks, _sfc_vecs, and MaterialPropertyLib::name.

Referenced by appendSurfaceVec(), GeoLib::DuplicateGeometry::duplicate(), mergeSurfaces(), GeoLib::IO::XmlGmlInterface::readFile(), GeoLib::IO::BoostXmlGmlInterface::readFile(), FileIO::Legacy::readGLIFileV4(), and FileIO::TetGenInterface::readTetGenGeometry().

◆ appendPolylineVec()

bool GeoLib::GEOObjects::appendPolylineVec ( const std::vector< Polyline * > &  polylines,
const std::string &  name 
)

copies the pointers to the polylines in the vector to the PolylineVec with provided name. the pointers are managed by the GEOObjects, i.e. GEOObjects will delete the Polylines at the end of its scope

Parameters
polylinesthe vector with polylines
namethe name of the internal PolylineVec
Returns
true if the polylines are appended, false if the PolylineVec with the corresponding name does not exist

Definition at line 172 of file GEOObjects.cpp.

174 {
175  // find an already existing PolylineVec object the given polylines will be
176  // appended to
177  auto polyline_vec_it =
178  std::find_if(_ply_vecs.begin(), _ply_vecs.end(),
179  [&name](auto* const polyline_vec)
180  { return polyline_vec->getName() == name; });
181  if (polyline_vec_it == _ply_vecs.end())
182  {
183  return false;
184  }
185  for (auto* polyline : polylines)
186  {
187  (*polyline_vec_it)->push_back(polyline);
188  }
189  _callbacks->appendPolylineVec(name);
190  return true;
191 }

References _callbacks, _ply_vecs, and MaterialPropertyLib::name.

Referenced by GEOModels::connectPolylineSegments(), and FileIO::GMSH::GMSHInterface::writeGMSHInputFile().

◆ appendSurfaceVec()

bool GeoLib::GEOObjects::appendSurfaceVec ( const std::vector< Surface * > &  surfaces,
const std::string &  name 
)

Copies the surfaces in the vector to the SurfaceVec with the given name.

Parameters
surfacesthe vector with surfaces
namethe name of the internal PolylineVec
Returns
true if the surfaces are appended, false if the SurfaceVec with the corresponding name does not exist and the surfaces are added.

Definition at line 255 of file GEOObjects.cpp.

257 {
258  // search vector
259  std::size_t idx(0);
260  bool nfound(true);
261  for (idx = 0; idx < _sfc_vecs.size() && nfound; idx++)
262  {
263  if (_sfc_vecs[idx]->getName() == name)
264  {
265  nfound = false;
266  }
267  }
268 
269  if (!nfound)
270  {
271  idx--;
272  std::size_t n_sfcs(surfaces.size());
273  // append surfaces
274  for (std::size_t k(0); k < n_sfcs; k++)
275  {
276  _sfc_vecs[idx]->push_back(surfaces[k]);
277  }
278  _callbacks->appendSurfaceVec(name);
279  return true;
280  }
281 
282  // the copy is needed because addSurfaceVec is passing it to SurfaceVec
283  // ctor, which needs write access to the surface vector.
284  auto sfc = std::make_unique<std::vector<GeoLib::Surface*>>(begin(surfaces),
285  end(surfaces));
286  addSurfaceVec(std::move(sfc), name);
287  return false;
288 }
std::string getName(std::string const &line)
Returns the name/title from the "Zone"-description.
void addSurfaceVec(std::unique_ptr< std::vector< Surface * >> sfc, const std::string &name, std::unique_ptr< std::map< std::string, std::size_t >> sfc_names=nullptr)
Definition: GEOObjects.cpp:244

References _callbacks, _sfc_vecs, addSurfaceVec(), getName(), and MaterialPropertyLib::name.

Referenced by GEOModels::connectPolylineSegments().

◆ exists()

std::size_t GeoLib::GEOObjects::exists ( const std::string &  geometry_name) const

Returns std::numeric_limits<std::size_t>::max() if no geometry of the given name exists or the index of the geometry in _pnt_vecs otherwise

Definition at line 814 of file GEOObjects.cpp.

815 {
816  std::size_t const size(_pnt_vecs.size());
817  for (std::size_t i = 0; i < size; i++)
818  {
819  if (_pnt_vecs[i]->getName() == geometry_name)
820  {
821  return i;
822  }
823  }
824 
825  // HACK for enabling conversion of files without loading the associated
826  // geometry
827  if (size > 0 && _pnt_vecs[0]->getName() == "conversionTestRun#1")
828  {
829  return 1;
830  }
831 
832  return std::numeric_limits<std::size_t>::max();
833 }

References _pnt_vecs, and getName().

Referenced by getPointVec(), and getPointVecObj().

◆ getElementNameByID()

std::string GeoLib::GEOObjects::getElementNameByID ( const std::string &  geometry_name,
GeoLib::GEOTYPE  type,
std::size_t  id 
) const

Definition at line 397 of file GEOObjects.cpp.

400 {
401  std::string name;
402  switch (type)
403  {
405  this->getPointVecObj(geometry_name)->getNameOfElementByID(id, name);
406  break;
408  this->getPolylineVecObj(geometry_name)
409  ->getNameOfElementByID(id, name);
410  break;
412  this->getSurfaceVecObj(geometry_name)
413  ->getNameOfElementByID(id, name);
414  }
415  return name;
416 }
const PointVec * getPointVecObj(const std::string &name) const
Definition: GEOObjects.cpp:84
SurfaceVec * getSurfaceVecObj(const std::string &name)
Returns the surface vector with the given name.
Definition: GEOObjects.h:205
const PolylineVec * getPolylineVecObj(const std::string &name) const
Definition: GEOObjects.cpp:210
bool getNameOfElementByID(std::size_t id, std::string &element_name) const
Definition: TemplateVec.h:153

References GeoLib::TemplateVec< T >::getNameOfElementByID(), getPointVecObj(), getPolylineVecObj(), getSurfaceVecObj(), MaterialPropertyLib::name, GeoLib::POINT, GeoLib::POLYLINE, and GeoLib::SURFACE.

Referenced by MainWindow::showGeoNameDialog().

◆ getGeometryNames()

std::vector< std::string > GeoLib::GEOObjects::getGeometryNames ( ) const

Returns the names of all geometry vectors.

Definition at line 384 of file GEOObjects.cpp.

385 {
386  std::vector<std::string> names;
387  for (auto point : _pnt_vecs)
388  {
389  if (point->getType() == PointVec::PointType::POINT)
390  {
391  names.push_back(point->getName());
392  }
393  }
394  return names;
395 }

References _pnt_vecs, and GeoLib::PointVec::POINT.

Referenced by GMSHPrefsDialog::GMSHPrefsDialog(), MergeGeometriesDialog::MergeGeometriesDialog(), OGSFileConverter::convertGML2GLI(), isUniquePointVecName(), main(), FileIO::readGeometryFromFile(), MainWindow::save(), FileIO::XmlPrjInterface::write(), and FileIO::Legacy::writeAllDataToGLIFileV4().

◆ getGeoObject() [1/2]

GeoLib::GeoObject const * GeoLib::GEOObjects::getGeoObject ( const std::string &  geo_name,
const std::string &  geo_obj_name 
) const

Return named (by the tuple geo_name and geo_obj_name) geo object.

Definition at line 786 of file GEOObjects.cpp.

788 {
789  GeoLib::GeoObject const* geo_obj(
790  getGeoObject(geo_name, GeoLib::GEOTYPE::POINT, geo_obj_name));
791 
792  if (!geo_obj)
793  {
794  geo_obj =
795  getGeoObject(geo_name, GeoLib::GEOTYPE::POLYLINE, geo_obj_name);
796  }
797 
798  if (!geo_obj)
799  {
800  geo_obj =
801  getGeoObject(geo_name, GeoLib::GEOTYPE::SURFACE, geo_obj_name);
802  }
803 
804  if (!geo_obj)
805  {
806  DBUG(
807  "GEOObjects::getGeoObject(): Could not find '{:s}' in geometry "
808  "{:s}.",
809  geo_obj_name, geo_name);
810  }
811  return geo_obj;
812 }
const GeoLib::GeoObject * getGeoObject(const std::string &geo_name, GeoLib::GEOTYPE type, const std::string &geo_obj_name) const
Returns the geo object for a geometric item of the given name and type for the associated geometry.
Definition: GEOObjects.cpp:729

References DBUG(), getGeoObject(), GeoLib::POINT, GeoLib::POLYLINE, and GeoLib::SURFACE.

◆ getGeoObject() [2/2]

const GeoLib::GeoObject * GeoLib::GEOObjects::getGeoObject ( const std::string &  geo_name,
GeoLib::GEOTYPE  type,
const std::string &  geo_obj_name 
) const

Returns the geo object for a geometric item of the given name and type for the associated geometry.

Definition at line 729 of file GEOObjects.cpp.

733 {
734  GeoLib::GeoObject* geo_obj(nullptr);
735  switch (type)
736  {
738  {
739  GeoLib::PointVec const* pnt_vec(getPointVecObj(geo_name));
740  if (pnt_vec)
741  {
742  geo_obj = const_cast<GeoLib::GeoObject*>(
743  dynamic_cast<GeoLib::GeoObject const*>(
744  pnt_vec->getElementByName(geo_obj_name)));
745  }
746  break;
747  }
749  {
750  GeoLib::PolylineVec const* ply_vec(getPolylineVecObj(geo_name));
751  if (ply_vec)
752  {
753  geo_obj = const_cast<GeoLib::GeoObject*>(
754  dynamic_cast<GeoLib::GeoObject const*>(
755  ply_vec->getElementByName(geo_obj_name)));
756  }
757  break;
758  }
760  {
761  GeoLib::SurfaceVec const* sfc_vec(getSurfaceVecObj(geo_name));
762  if (sfc_vec)
763  {
764  geo_obj = const_cast<GeoLib::GeoObject*>(
765  dynamic_cast<GeoLib::GeoObject const*>(
766  sfc_vec->getElementByName(geo_obj_name)));
767  }
768  break;
769  }
770  default:
771  ERR("GEOObjects::getGeoObject(): geometric type not handled.");
772  return nullptr;
773  };
774 
775  if (!geo_obj)
776  {
777  DBUG(
778  "GEOObjects::getGeoObject(): Could not find {:s} '{:s}' in "
779  "geometry.",
781  geo_obj_name);
782  }
783  return geo_obj;
784 }
void ERR(char const *fmt, Args const &... args)
Definition: Logging.h:42
This class manages pointers to Points in a std::vector along with a name. It also handles the deletio...
Definition: PointVec.h:38
The class TemplateVec takes a unique name and manages a std::vector of pointers to data elements of t...
Definition: TemplateVec.h:40
std::string convertGeoTypeToString(GEOTYPE geo_type)
Definition: GeoType.cpp:23

References GeoLib::convertGeoTypeToString(), DBUG(), ERR(), GeoLib::TemplateVec< T >::getElementByName(), getPointVecObj(), getPolylineVecObj(), getSurfaceVecObj(), GeoLib::POINT, GeoLib::POLYLINE, and GeoLib::SURFACE.

Referenced by GEOModels::addNameForObjectPoints(), and getGeoObject().

◆ getPoints()

std::vector<PointVec*> const& GeoLib::GEOObjects::getPoints ( ) const
inline

Read access to points w/o using a name.

Definition at line 286 of file GEOObjects.h.

286 { return _pnt_vecs; }

References _pnt_vecs.

Referenced by MeshGeoToolsLib::constructAdditionalMeshesFromGeoObjects().

◆ getPointVec()

const std::vector< Point * > * GeoLib::GEOObjects::getPointVec ( const std::string &  name) const

◆ getPointVecObj() [1/2]

PointVec* GeoLib::GEOObjects::getPointVecObj ( const std::string &  name)
inline

Returns a pointer to a PointVec object for the given name.

Definition at line 110 of file GEOObjects.h.

111  {
112  return const_cast<PointVec*>(static_cast<const GEOObjects&>(*this).
114  }

References getPointVecObj(), and MaterialPropertyLib::name.

◆ getPointVecObj() [2/2]

const PointVec * GeoLib::GEOObjects::getPointVecObj ( const std::string &  name) const

search and returns the PointVec object with the given name.

Parameters
namethe name of the PointVec object
Returns
the PointVec object stored in GEOObjects

Definition at line 84 of file GEOObjects.cpp.

85 {
86  std::size_t const idx = this->exists(name);
87  if (idx != std::numeric_limits<std::size_t>::max())
88  {
89  return _pnt_vecs[idx];
90  }
91 
92  DBUG("GEOObjects::getPointVecObj() - No entry found with name '{:s}'.",
93  name);
94  return nullptr;
95 }

References _pnt_vecs, DBUG(), exists(), and MaterialPropertyLib::name.

Referenced by GEOModels::addNameForElement(), GEOModels::addNameForObjectPoints(), GEOModels::addPointVec(), FileIO::GMSH::GMSHPolygonTree::checkIntersectionsSegmentExistingPolylines(), MeshLib::convertMeshToGeo(), FileIO::SwmmInterface::convertSwmmInputToGeometry(), GeoLib::DuplicateGeometry::duplicate(), GeoLib::geoPointsToStations(), getElementNameByID(), getGeoObject(), getPointVecObj(), FileIO::GMSH::GMSHPolygonTree::insertPolyline(), main(), mergePoints(), mergePolylines(), mergeSurfaces(), GeoLib::IO::XmlGmlInterface::readFile(), GeoLib::IO::BoostXmlGmlInterface::readFile(), FileIO::Legacy::readGLIFileV4(), FileIO::SHPInterface::readPolylines(), FileIO::TetGenInterface::readTetGenGeometry(), GEOModels::updateGeometry(), GeoLib::IO::BoostXmlGmlInterface::write(), GeoLib::IO::XmlGmlInterface::write(), FileIO::GMSH::GMSHPolygonTree::writeAdditionalPointData(), FileIO::Legacy::writeAllDataToGLIFileV4(), writeBCsAndGeometry(), FileIO::Legacy::writeGLIFileV4(), and FileIO::GMSH::GMSHInterface::writeGMSHInputFile().

◆ getPolylines()

std::vector<PolylineVec*> const& GeoLib::GEOObjects::getPolylines ( ) const
inline

Read access to polylines w/o using a name.

Definition at line 288 of file GEOObjects.h.

288 { return _ply_vecs; }

References _ply_vecs.

Referenced by MeshGeoToolsLib::constructAdditionalMeshesFromGeoObjects().

◆ getPolylineVec()

const std::vector< Polyline * > * GeoLib::GEOObjects::getPolylineVec ( const std::string &  name) const

Returns the polyline vector with the given name.

Definition at line 193 of file GEOObjects.cpp.

195 {
196  std::size_t size(_ply_vecs.size());
197  for (std::size_t i = 0; i < size; i++)
198  {
199  if (_ply_vecs[i]->getName() == name)
200  {
201  return _ply_vecs[i]->getVector();
202  }
203  }
204 
205  DBUG("GEOObjects::getPolylineVec() - No entry found with name '{:s}'.",
206  name);
207  return nullptr;
208 }

References _ply_vecs, DBUG(), getName(), and MaterialPropertyLib::name.

Referenced by GeoLib::DuplicateGeometry::duplicate(), GeoLib::DuplicateGeometry::getPolylineVectorCopy(), main(), mergePolylines(), FileIO::Legacy::readGLIFileV4(), FileIO::SHPInterface::readPolygons(), and FileIO::GMSH::GMSHInterface::writeGMSHInputFile().

◆ getPolylineVecObj() [1/2]

PolylineVec* GeoLib::GEOObjects::getPolylineVecObj ( const std::string &  name)
inline

Returns a pointer to a PolylineVec object for the given name.

Definition at line 172 of file GEOObjects.h.

173  {
174  return const_cast<PolylineVec*>(static_cast<const GEOObjects&>(*this).
176  }

References getPolylineVecObj(), and MaterialPropertyLib::name.

◆ getPolylineVecObj() [2/2]

const PolylineVec * GeoLib::GEOObjects::getPolylineVecObj ( const std::string &  name) const

Returns a pointer to a PolylineVec object for the given name as a const.

Parameters
namethe name of the vector of polylines
Returns
PolylineVec object

Definition at line 210 of file GEOObjects.cpp.

211 {
212  std::size_t size(_ply_vecs.size());
213  for (std::size_t i = 0; i < size; i++)
214  {
215  if (_ply_vecs[i]->getName() == name)
216  {
217  return _ply_vecs[i];
218  }
219  }
220 
221  DBUG("GEOObjects::getPolylineVecObj() - No entry found with name '{:s}'.",
222  name);
223  return nullptr;
224 }

References _ply_vecs, DBUG(), getName(), and MaterialPropertyLib::name.

Referenced by GEOModels::addNameForElement(), GeoLib::IO::BoostXmlGmlInterface::addPolylinesToPropertyTree(), GEOModels::addPolylineVec(), GEOModels::appendPolylineVec(), GEOModels::connectPolylineSegments(), GeoLib::DuplicateGeometry::duplicate(), getElementNameByID(), getGeoObject(), getPolylineVecObj(), main(), GeoLib::markUnusedPoints(), mergePolylines(), FileIO::Legacy::readGLIFileV4(), MainWindow::showLineEditDialog(), GEOModels::updateGeometry(), GeoLib::IO::XmlGmlInterface::write(), FileIO::Legacy::writeAllDataToGLIFileV4(), and FileIO::Legacy::writeGLIFileV4().

◆ getStationVec()

const std::vector< GeoLib::Point * > * GeoLib::GEOObjects::getStationVec ( const std::string &  name) const

Returns the station vector with the given name.

Definition at line 131 of file GEOObjects.cpp.

133 {
134  auto const it =
135  std::find_if(begin(_pnt_vecs), end(_pnt_vecs),
136  [&name](PointVec const* const p)
137  {
138  return p->getName() == name &&
139  p->getType() == PointVec::PointType::STATION;
140  });
141  if (it != end(_pnt_vecs))
142  {
143  return (*it)->getVector();
144  }
145  DBUG("GEOObjects::getStationVec() - No entry found with name '{:s}'.",
146  name);
147  return nullptr;
148 }

References _pnt_vecs, DBUG(), MaterialPropertyLib::name, and GeoLib::PointVec::STATION.

Referenced by GEOModels::addStationVec(), MainWindow::exportBoreholesToGMS(), MainWindow::showStationNameDialog(), GEOModels::updateGeometry(), GeoLib::IO::XmlStnInterface::write(), FileIO::Legacy::writeAllDataToGLIFileV4(), and FileIO::GMSH::GMSHInterface::writeGMSHInputFile().

◆ getStationVectorNames()

void GeoLib::GEOObjects::getStationVectorNames ( std::vector< std::string > &  names) const

Returns the names of all station vectors.

Definition at line 373 of file GEOObjects.cpp.

374 {
375  for (auto point : _pnt_vecs)
376  {
377  if (point->getType() == PointVec::PointType::STATION)
378  {
379  names.push_back(point->getName());
380  }
381  }
382 }

References _pnt_vecs, and GeoLib::PointVec::STATION.

Referenced by GMSHPrefsDialog::GMSHPrefsDialog(), MergeGeometriesDialog::MergeGeometriesDialog(), FileIO::XmlPrjInterface::write(), and FileIO::Legacy::writeAllDataToGLIFileV4().

◆ getSurfaces()

std::vector<SurfaceVec*> const& GeoLib::GEOObjects::getSurfaces ( ) const
inline

Read access to surfaces w/o using a name.

Definition at line 290 of file GEOObjects.h.

290 { return _sfc_vecs; }

References _sfc_vecs.

Referenced by MeshGeoToolsLib::constructAdditionalMeshesFromGeoObjects().

◆ getSurfaceVec()

const std::vector< Surface * > * GeoLib::GEOObjects::getSurfaceVec ( const std::string &  name) const

Returns the surface vector with the given name as a const.

Definition at line 290 of file GEOObjects.cpp.

292 {
293  std::size_t size(_sfc_vecs.size());
294  for (std::size_t i = 0; i < size; i++)
295  {
296  if (_sfc_vecs[i]->getName() == name)
297  {
298  return _sfc_vecs[i]->getVector();
299  }
300  }
301  DBUG("GEOObjects::getSurfaceVec() - No entry found with name '{:s}'.",
302  name);
303  return nullptr;
304 }

References _sfc_vecs, DBUG(), getName(), and MaterialPropertyLib::name.

Referenced by GeoLib::DuplicateGeometry::duplicate(), GeoLib::DuplicateGeometry::getSurfaceVectorCopy(), main(), mergeSurfaces(), and FileIO::TetGenInterface::writeTetGenSmesh().

◆ getSurfaceVecObj() [1/2]

◆ getSurfaceVecObj() [2/2]

const SurfaceVec * GeoLib::GEOObjects::getSurfaceVecObj ( const std::string &  name) const

Returns a pointer to a SurfaceVec object for the given name. The class SurfaceVec stores the relation between surfaces and the names of the surfaces.

Parameters
namethe name of the vector of surfaces (the project name)
Returns
SurfaceVec object

Definition at line 324 of file GEOObjects.cpp.

325 {
326  std::size_t size(_sfc_vecs.size());
327  for (std::size_t i = 0; i < size; i++)
328  {
329  if (_sfc_vecs[i]->getName() == name)
330  {
331  return _sfc_vecs[i];
332  }
333  }
334  DBUG("GEOObjects::getSurfaceVecObj() - No entry found with name '{:s}'.",
335  name);
336  return nullptr;
337 }

References _sfc_vecs, DBUG(), getName(), and MaterialPropertyLib::name.

◆ isPntVecUsed()

bool GeoLib::GEOObjects::isPntVecUsed ( const std::string &  name) const

Checks if the point vector with the given name is referenced in a polyline- or surface vector.

Definition at line 352 of file GEOObjects.cpp.

353 {
354  // search dependent data structures (Polyline)
355  for (auto polyline : _ply_vecs)
356  {
357  if (polyline->getName() == name)
358  {
359  return true;
360  }
361  }
362  for (auto surface : _sfc_vecs)
363  {
364  if (surface->getName() == name)
365  {
366  return true;
367  }
368  }
369 
370  return false;
371 }

References _ply_vecs, _sfc_vecs, and MaterialPropertyLib::name.

Referenced by removePointVec(), and GEOModels::removePointVec().

◆ isUniquePointVecName()

bool GeoLib::GEOObjects::isUniquePointVecName ( std::string &  name) const

Determines if the given name is unique among all the names in point vectors and creates a new name if this is not the case. The new name is then simply "name + x", where x>1 is the smallest number that creates a unique name (i.e. "name-2", "name-3", etc.)

Parameters
nameOriginal name of the list, this name might be changed within this method if necessary.
Returns
true if the name was unique, false if a new name has been generated

Definition at line 339 of file GEOObjects.cpp.

340 {
341  std::vector<std::string> const existing_names = getGeometryNames();
342  auto const& unique_name = BaseLib::getUniqueName(existing_names, name);
343 
344  if (unique_name != name)
345  {
346  name = unique_name;
347  return false;
348  }
349  return true;
350 }
std::vector< std::string > getGeometryNames() const
Returns the names of all geometry vectors.
Definition: GEOObjects.cpp:384
std::string getUniqueName(std::vector< std::string > const &existing_names, std::string const &input_name)
Append '-' and a number such that the name is unique.

References getGeometryNames(), BaseLib::getUniqueName(), and MaterialPropertyLib::name.

Referenced by MergeGeometriesDialog::MergeGeometriesDialog(), addPointVec(), and addStationVec().

◆ mergeGeometries()

int GeoLib::GEOObjects::mergeGeometries ( std::vector< std::string > const &  geo_names,
std::string &  merged_geo_name 
)

Method mergeGeometries merges the geometries that are given by the names in the vector. Stations points are not included in the resulting merged geometry.

Parameters
geo_namesthe names of the geometries that are to be merged
merged_geo_namethe name of the resulting geometry
Returns
0 if success, 1 if no point-list is found for at least one of the geometries and 2 if the mergelist only contains less than two geometry

Definition at line 418 of file GEOObjects.cpp.

420 {
421  const std::size_t n_geo_names(geo_names.size());
422 
423  if (n_geo_names < 2)
424  {
425  return 2;
426  }
427 
428  std::vector<std::size_t> pnt_offsets(n_geo_names, 0);
429 
430  if (!mergePoints(geo_names, merged_geo_name, pnt_offsets))
431  {
432  return 1;
433  }
434 
435  mergePolylines(geo_names, merged_geo_name, pnt_offsets);
436 
437  mergeSurfaces(geo_names, merged_geo_name, pnt_offsets);
438 
439  return 0;
440 }
void mergeSurfaces(std::vector< std::string > const &geo_names, std::string const &merged_geo_name, std::vector< std::size_t > const &pnt_offsets)
Definition: GEOObjects.cpp:554
void mergePolylines(std::vector< std::string > const &geo_names, std::string const &merged_geo_name, std::vector< std::size_t > const &pnt_offsets)
Definition: GEOObjects.cpp:495
bool mergePoints(std::vector< std::string > const &geo_names, std::string &merged_geo_name, std::vector< std::size_t > &pnt_offsets)
Definition: GEOObjects.cpp:442

References mergePoints(), mergePolylines(), and mergeSurfaces().

Referenced by GeoLib::Grid< POINT >::createGridGeometry(), FileIO::createSurface(), main(), MainWindow::showMergeGeometriesDialog(), and FileIO::GMSH::GMSHInterface::writeGMSHInputFile().

◆ mergePoints()

bool GeoLib::GEOObjects::mergePoints ( std::vector< std::string > const &  geo_names,
std::string &  merged_geo_name,
std::vector< std::size_t > &  pnt_offsets 
)
private

Method merges points from different geometries into one geometry. This is a helper method for GEOObjects::mergeGeometries().

Parameters
geo_namesThe vector of names of the geometries to merge.
merged_geo_nameThe (new) name of the geometry resulting from merging.
pnt_offsetsoffsets in the merged vector storing the points
Returns
true, if merging the points succeeded, else false

Definition at line 442 of file GEOObjects.cpp.

445 {
446  const std::size_t n_geo_names(geo_names.size());
447 
448  auto merged_points = std::make_unique<std::vector<GeoLib::Point*>>();
449  auto merged_pnt_names =
450  std::make_unique<std::map<std::string, std::size_t>>();
451 
452  for (std::size_t j(0); j < n_geo_names; ++j)
453  {
454  GeoLib::PointVec const* const pnt_vec(
455  this->getPointVecObj(geo_names[j]));
456  if (pnt_vec == nullptr)
457  {
458  continue;
459  }
460  const std::vector<GeoLib::Point*>* pnts(pnt_vec->getVector());
461  if (pnts == nullptr)
462  {
463  return false;
464  }
465 
466  // do not consider stations
467  if (dynamic_cast<GeoLib::Station*>((*pnts)[0]))
468  {
469  continue;
470  }
471 
472  std::size_t const n_pnts(pnts->size());
473  for (std::size_t k(0); k < n_pnts; ++k)
474  {
475  merged_points->push_back(
476  new GeoLib::Point(*(*pnts)[k], pnt_offsets[j] + k));
477  std::string const& item_name(pnt_vec->getItemNameByID(k));
478  if (!item_name.empty())
479  {
480  merged_pnt_names->insert(
481  std::make_pair(item_name, pnt_offsets[j] + k));
482  }
483  }
484  if (n_geo_names - 1 > j)
485  {
486  pnt_offsets[j + 1] = n_pnts + pnt_offsets[j];
487  }
488  }
489 
490  addPointVec(std::move(merged_points), merged_geo_name,
491  std::move(merged_pnt_names), 1e-6);
492  return true;
493 }
void addPointVec(std::unique_ptr< std::vector< Point * >> points, std::string &name, std::unique_ptr< std::map< std::string, std::size_t >> pnt_id_name_map=nullptr, double eps=std::sqrt(std::numeric_limits< double >::epsilon()))
Definition: GEOObjects.cpp:51
A Station (observation site) is basically a Point with some additional information.
Definition: Station.h:37

References addPointVec(), GeoLib::PointVec::getItemNameByID(), getPointVecObj(), and GeoLib::TemplateVec< T >::getVector().

Referenced by mergeGeometries().

◆ mergePolylines()

void GeoLib::GEOObjects::mergePolylines ( std::vector< std::string > const &  geo_names,
std::string const &  merged_geo_name,
std::vector< std::size_t > const &  pnt_offsets 
)
private

Method merges GeoLib::Polylines from different geometries into one geometry. There isn't a check if the polyline is unique within the given data sets. If there are two polylines with the same name, the second occurrence will lost their name. This is a helper for GEOObjects::mergeGeometries() and should be used only after GEOObjects::mergePoints() is executed.

Parameters
geo_namesThe vector of names of the geometries to merge.
merged_geo_nameThe (new) name of the geometry resulting from merging.
pnt_offsetsoffsets in the merged vector storing the points.

Definition at line 495 of file GEOObjects.cpp.

498 {
499  const std::size_t n_geo_names(geo_names.size());
500  std::vector<std::size_t> ply_offsets(n_geo_names, 0);
501 
502  auto merged_polylines = std::make_unique<std::vector<GeoLib::Polyline*>>();
503  auto merged_ply_names =
504  std::make_unique<std::map<std::string, std::size_t>>();
505 
506  std::vector<GeoLib::Point*> const* merged_points(
507  this->getPointVecObj(merged_geo_name)->getVector());
508  std::vector<std::size_t> const& id_map(
509  this->getPointVecObj(merged_geo_name)->getIDMap());
510 
511  for (std::size_t j(0); j < n_geo_names; j++)
512  {
513  const std::vector<GeoLib::Polyline*>* plys(
514  this->getPolylineVec(geo_names[j]));
515  if (plys)
516  {
517  std::string tmp_name;
518  for (std::size_t k(0); k < plys->size(); k++)
519  {
520  auto* kth_ply_new(new GeoLib::Polyline(*merged_points));
521  GeoLib::Polyline const* const kth_ply_old((*plys)[k]);
522  const std::size_t size_of_kth_ply(
523  kth_ply_old->getNumberOfPoints());
524  // copy point ids from old ply to new ply (considering the
525  // offset)
526  for (std::size_t i(0); i < size_of_kth_ply; i++)
527  {
528  kth_ply_new->addPoint(
529  id_map[pnt_offsets[j] + kth_ply_old->getPointID(i)]);
530  }
531  merged_polylines->push_back(kth_ply_new);
532  if (this->getPolylineVecObj(geo_names[j])
533  ->getNameOfElementByID(k, tmp_name))
534  {
535  merged_ply_names->insert(
536  std::pair<std::string, std::size_t>(
537  tmp_name, ply_offsets[j] + k));
538  }
539  }
540  if (n_geo_names - 1 > j)
541  {
542  ply_offsets[j + 1] = plys->size() + ply_offsets[j];
543  }
544  }
545  }
546 
547  if (!merged_polylines->empty())
548  {
549  this->addPolylineVec(std::move(merged_polylines), merged_geo_name,
550  std::move(merged_ply_names));
551  }
552 }
const std::vector< Polyline * > * getPolylineVec(const std::string &name) const
Definition: GEOObjects.cpp:193
void addPolylineVec(std::unique_ptr< std::vector< Polyline * >> lines, const std::string &name, std::unique_ptr< std::map< std::string, std::size_t >> ply_names=nullptr)
Definition: GEOObjects.cpp:150
Class Polyline consists mainly of a reference to a point vector and a vector that stores the indices ...
Definition: Polyline.h:51

References addPolylineVec(), GeoLib::Polyline::getNumberOfPoints(), GeoLib::Polyline::getPointID(), getPointVecObj(), getPolylineVec(), and getPolylineVecObj().

Referenced by mergeGeometries().

◆ mergeSurfaces()

void GeoLib::GEOObjects::mergeSurfaces ( std::vector< std::string > const &  geo_names,
std::string const &  merged_geo_name,
std::vector< std::size_t > const &  pnt_offsets 
)
private

Method merges GeoLib::Surfaces from different geometries into one geometry. There isn't a check if the GeoLib::Surface is unique within the given data sets. This is a helper for GEOObjects::mergeGeometries() and should be used only after GEOObjects::mergePoints() is executed.

Parameters
geo_namesThe vector of names of the geometries to merge.
merged_geo_nameThe (new) name of the geometry resulting from merging.
pnt_offsetsoffsets in the merged vector storing the points.

Definition at line 554 of file GEOObjects.cpp.

557 {
558  std::vector<GeoLib::Point*> const* merged_points(
559  this->getPointVecObj(merged_geo_name)->getVector());
560  std::vector<std::size_t> const& id_map(
561  this->getPointVecObj(merged_geo_name)->getIDMap());
562 
563  const std::size_t n_geo_names(geo_names.size());
564  std::vector<std::size_t> sfc_offsets(n_geo_names, 0);
565  auto merged_sfcs = std::make_unique<std::vector<GeoLib::Surface*>>();
566  auto merged_sfc_names =
567  std::make_unique<std::map<std::string, std::size_t>>();
568  for (std::size_t j(0); j < n_geo_names; j++)
569  {
570  const std::vector<GeoLib::Surface*>* sfcs(
571  this->getSurfaceVec(geo_names[j]));
572  if (sfcs)
573  {
574  std::string tmp_name;
575  for (std::size_t k(0); k < sfcs->size(); k++)
576  {
577  auto* kth_sfc_new(new GeoLib::Surface(*merged_points));
578  GeoLib::Surface const* const kth_sfc_old((*sfcs)[k]);
579  const std::size_t size_of_kth_sfc(
580  kth_sfc_old->getNumberOfTriangles());
581  // clone surface elements using new ids
582  for (std::size_t i(0); i < size_of_kth_sfc; i++)
583  {
584  const GeoLib::Triangle* tri((*kth_sfc_old)[i]);
585  const std::size_t id0(id_map[pnt_offsets[j] + (*tri)[0]]);
586  const std::size_t id1(id_map[pnt_offsets[j] + (*tri)[1]]);
587  const std::size_t id2(id_map[pnt_offsets[j] + (*tri)[2]]);
588  kth_sfc_new->addTriangle(id0, id1, id2);
589  }
590  merged_sfcs->push_back(kth_sfc_new);
591 
592  if (this->getSurfaceVecObj(geo_names[j])
593  ->getNameOfElementByID(k, tmp_name))
594  {
595  merged_sfc_names->insert(
596  std::pair<std::string, std::size_t>(
597  tmp_name, sfc_offsets[j] + k));
598  }
599  }
600  if (n_geo_names - 1 > j)
601  {
602  sfc_offsets[j + 1] = sfcs->size() + sfc_offsets[j];
603  }
604  }
605  }
606  if (!merged_sfcs->empty())
607  {
608  this->addSurfaceVec(std::move(merged_sfcs), merged_geo_name,
609  std::move(merged_sfc_names));
610  }
611 }
const std::vector< Surface * > * getSurfaceVec(const std::string &name) const
Returns the surface vector with the given name as a const.
Definition: GEOObjects.cpp:290
A Surface is represented by Triangles. It consists of a reference to a vector of (pointers to) points...
Definition: Surface.h:34
Class Triangle consists of a reference to a point vector and a vector that stores the indices in the ...
Definition: Triangle.h:26

References addSurfaceVec(), GeoLib::Surface::getNumberOfTriangles(), getPointVecObj(), getSurfaceVec(), and getSurfaceVecObj().

Referenced by mergeGeometries().

◆ removePointVec()

bool GeoLib::GEOObjects::removePointVec ( const std::string &  name)

If there exists no dependencies the point vector with the given name from GEOObjects will be removed and the method returns true, else the return value is false.

Definition at line 97 of file GEOObjects.cpp.

98 {
99  if (isPntVecUsed(name))
100  {
101  DBUG(
102  "GEOObjects::removePointVec() - There are still Polylines or "
103  "Surfaces depending on these points.");
104  return false;
105  }
106 
107  for (auto it(_pnt_vecs.begin()); it != _pnt_vecs.end(); ++it)
108  {
109  if ((*it)->getName() == name)
110  {
111  _callbacks->removePointVec(name);
112  delete *it;
113  _pnt_vecs.erase(it);
114  return true;
115  }
116  }
117  DBUG("GEOObjects::removePointVec() - No entry found with name '{:s}'.",
118  name);
119  return false;
120 }
bool isPntVecUsed(const std::string &name) const
Checks if the point vector with the given name is referenced in a polyline- or surface vector.
Definition: GEOObjects.cpp:352

References _callbacks, _pnt_vecs, DBUG(), isPntVecUsed(), and MaterialPropertyLib::name.

Referenced by consolidateGeometry(), OGSFileConverter::convertGLI2GML(), OGSFileConverter::convertGML2GLI(), FileIO::SwmmInterface::convertSwmmInputToGeometry(), FileIO::createSurface(), GeoLib::IO::XmlGmlInterface::readFile(), GEOModels::removeGeometry(), removeStationVec(), and FileIO::GMSH::GMSHInterface::writeGMSHInputFile().

◆ removePolylineVec()

bool GeoLib::GEOObjects::removePolylineVec ( const std::string &  name)

If no Surfaces depends on the vector of Polylines with the given name it will be removed and the method returns true, else the return value is false.

Definition at line 226 of file GEOObjects.cpp.

227 {
228  _callbacks->removePolylineVec(name);
229  for (auto it = _ply_vecs.begin(); it != _ply_vecs.end(); ++it)
230  {
231  if ((*it)->getName() == name)
232  {
233  delete *it;
234  _ply_vecs.erase(it);
235  return true;
236  }
237  }
238 
239  DBUG("GEOObjects::removePolylineVec() - No entry found with name '{:s}'.",
240  name);
241  return false;
242 }

References _callbacks, _ply_vecs, DBUG(), and MaterialPropertyLib::name.

Referenced by consolidateGeometry(), OGSFileConverter::convertGLI2GML(), OGSFileConverter::convertGML2GLI(), FileIO::createSurface(), GeoLib::IO::XmlGmlInterface::readFile(), GEOModels::removeGeometry(), and FileIO::GMSH::GMSHInterface::writeGMSHInputFile().

◆ removeStationVec()

bool GeoLib::GEOObjects::removeStationVec ( const std::string &  name)
inline

Removes the station vector with the given name from GEOObjects.

Definition at line 131 of file GEOObjects.h.

132  {
133  _callbacks->removeStationVec(name);
134  return removePointVec(name);
135  }
bool removePointVec(const std::string &name)
Definition: GEOObjects.cpp:97

References _callbacks, MaterialPropertyLib::name, and removePointVec().

Referenced by FileIO::GMSH::GMSHInterface::writeGMSHInputFile().

◆ removeSurfaceVec()

bool GeoLib::GEOObjects::removeSurfaceVec ( const std::string &  name)

removes the vector of Surfaces with the given name

Definition at line 306 of file GEOObjects.cpp.

307 {
308  _callbacks->removeSurfaceVec(name);
309  for (auto it(_sfc_vecs.begin()); it != _sfc_vecs.end(); ++it)
310  {
311  if ((*it)->getName() == name)
312  {
313  delete *it;
314  _sfc_vecs.erase(it);
315  return true;
316  }
317  }
318 
319  DBUG("GEOObjects::removeSurfaceVec() - No entry found with name '{:s}'.",
320  name);
321  return false;
322 }

References _callbacks, _sfc_vecs, DBUG(), and MaterialPropertyLib::name.

Referenced by OGSFileConverter::convertGLI2GML(), OGSFileConverter::convertGML2GLI(), FileIO::createSurface(), GEOModels::removeGeometry(), and FileIO::GMSH::GMSHInterface::writeGMSHInputFile().

◆ renameGeometry()

void GeoLib::GEOObjects::renameGeometry ( std::string const &  old_name,
std::string const &  new_name 
)

Renames an existing geometry, i.e. renames the internal PointVec, PolylineVec and the SurfaceVec objects from old_name to new_name. If no such PointVec, PolylineVec and SurfaceVec objects exist nothing will happen.

Definition at line 613 of file GEOObjects.cpp.

615 {
616  _callbacks->renameGeometry(old_name, new_name);
617  for (auto* pnt_vec : _pnt_vecs)
618  {
619  if (pnt_vec->getName() == old_name)
620  {
621  pnt_vec->setName(new_name);
622  break;
623  }
624  }
625  for (auto* ply_vec : _ply_vecs)
626  {
627  if (ply_vec->getName() == old_name)
628  {
629  ply_vec->setName(new_name);
630  break;
631  }
632  }
633  for (auto* sfc_vec : _sfc_vecs)
634  {
635  if (sfc_vec->getName() == old_name)
636  {
637  sfc_vec->setName(new_name);
638  break;
639  }
640  }
641 }

References _callbacks, _ply_vecs, _pnt_vecs, and _sfc_vecs.

Referenced by FileIO::createSurface().

Member Data Documentation

◆ _callbacks

◆ _ply_vecs

std::vector<PolylineVec*> GeoLib::GEOObjects::_ply_vecs

vector manages pointers to PolylineVec objects

Definition at line 298 of file GEOObjects.h.

Referenced by ~GEOObjects(), addPolylineVec(), appendPolylineVec(), getPolylines(), getPolylineVec(), getPolylineVecObj(), isPntVecUsed(), removePolylineVec(), and renameGeometry().

◆ _pnt_vecs

std::vector<PointVec*> GeoLib::GEOObjects::_pnt_vecs

◆ _sfc_vecs

std::vector<SurfaceVec*> GeoLib::GEOObjects::_sfc_vecs

vector manages pointers to SurfaceVec objects

Definition at line 300 of file GEOObjects.h.

Referenced by ~GEOObjects(), addSurfaceVec(), appendSurfaceVec(), getSurfaces(), getSurfaceVec(), getSurfaceVecObj(), isPntVecUsed(), removeSurfaceVec(), and renameGeometry().

◆ addPolylineVecCallback

std::function<void(std::string const&)> GeoLib::GEOObjects::addPolylineVecCallback
Initial value:
=
[](std::string const& ) {}

Definition at line 304 of file GEOObjects.h.

◆ addSurfaceVecCallback

std::function<void(std::string const&)> GeoLib::GEOObjects::addSurfaceVecCallback
Initial value:
=
[](std::string const& ) {}

Definition at line 313 of file GEOObjects.h.

◆ appendPolylineVecCallback

std::function<void(std::string const&)> GeoLib::GEOObjects::appendPolylineVecCallback
Initial value:
=
[](std::string const& ) {}

Definition at line 307 of file GEOObjects.h.

◆ appendSurfaceVecCallback

std::function<void(std::string const&)> GeoLib::GEOObjects::appendSurfaceVecCallback
Initial value:
=
[](std::string const& ) {}

Definition at line 316 of file GEOObjects.h.

◆ removePolylineVecCallback

std::function<void(std::string const&)> GeoLib::GEOObjects::removePolylineVecCallback
Initial value:
=
[](std::string const& ) {}

Definition at line 310 of file GEOObjects.h.

◆ removeSurfaceVecCallback

std::function<void(std::string const&)> GeoLib::GEOObjects::removeSurfaceVecCallback
Initial value:
=
[](std::string const& ) {}

Definition at line 319 of file GEOObjects.h.


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