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:356
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  for (auto it(lines->begin()); it != lines->end();)
158  {
159  if ((*it)->getNumberOfPoints() < 2)
160  {
161  auto it_erase(it);
162  it = lines->erase(it_erase);
163  }
164  else
165  {
166  ++it;
167  }
168  }
169 
170  if (lines->empty())
171  {
172  return;
173  }
174 
175  _ply_vecs.push_back(
176  new PolylineVec(name, std::move(lines), std::move(ply_names)));
177  _callbacks->addPolylineVec(name);
178 }
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 261 of file GEOObjects.cpp.

266 {
267  _sfc_vecs.push_back(
268  new SurfaceVec(name, std::move(sfc), std::move(sfc_names)));
269  _callbacks->addSurfaceVec(name);
270 }
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 180 of file GEOObjects.cpp.

182 {
183  // search vector
184  std::size_t idx(0);
185  bool nfound(true);
186  for (idx = 0; idx < _ply_vecs.size() && nfound; idx++)
187  {
188  if (_ply_vecs[idx]->getName() == name)
189  {
190  nfound = false;
191  }
192  }
193 
194  if (!nfound)
195  {
196  idx--;
197  std::size_t n_plys(polylines.size());
198  // append lines
199  for (std::size_t k(0); k < n_plys; k++)
200  {
201  _ply_vecs[idx]->push_back(polylines[k]);
202  }
203  _callbacks->appendPolylineVec(name);
204  return true;
205  }
206 
207  return false;
208 }
std::string getName(std::string const &line)
Returns the name/title from the "Zone"-description.

References _callbacks, _ply_vecs, getName(), 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 272 of file GEOObjects.cpp.

274 {
275  // search vector
276  std::size_t idx(0);
277  bool nfound(true);
278  for (idx = 0; idx < _sfc_vecs.size() && nfound; idx++)
279  {
280  if (_sfc_vecs[idx]->getName() == name)
281  {
282  nfound = false;
283  }
284  }
285 
286  if (!nfound)
287  {
288  idx--;
289  std::size_t n_sfcs(surfaces.size());
290  // append surfaces
291  for (std::size_t k(0); k < n_sfcs; k++)
292  {
293  _sfc_vecs[idx]->push_back(surfaces[k]);
294  }
295  _callbacks->appendSurfaceVec(name);
296  return true;
297  }
298 
299  // the copy is needed because addSurfaceVec is passing it to SurfaceVec
300  // ctor, which needs write access to the surface vector.
301  auto sfc = std::make_unique<std::vector<GeoLib::Surface*>>(begin(surfaces),
302  end(surfaces));
303  addSurfaceVec(std::move(sfc), name);
304  return false;
305 }
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:261

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 831 of file GEOObjects.cpp.

832 {
833  std::size_t const size(_pnt_vecs.size());
834  for (std::size_t i = 0; i < size; i++)
835  {
836  if (_pnt_vecs[i]->getName() == geometry_name)
837  {
838  return i;
839  }
840  }
841 
842  // HACK for enabling conversion of files without loading the associated
843  // geometry
844  if (size > 0 && _pnt_vecs[0]->getName() == "conversionTestRun#1")
845  {
846  return 1;
847  }
848 
849  return std::numeric_limits<std::size_t>::max();
850 }

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 414 of file GEOObjects.cpp.

417 {
418  std::string name;
419  switch (type)
420  {
422  this->getPointVecObj(geometry_name)->getNameOfElementByID(id, name);
423  break;
425  this->getPolylineVecObj(geometry_name)
426  ->getNameOfElementByID(id, name);
427  break;
429  this->getSurfaceVecObj(geometry_name)
430  ->getNameOfElementByID(id, name);
431  }
432  return name;
433 }
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:227
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 401 of file GEOObjects.cpp.

402 {
403  std::vector<std::string> names;
404  for (auto point : _pnt_vecs)
405  {
406  if (point->getType() == PointVec::PointType::POINT)
407  {
408  names.push_back(point->getName());
409  }
410  }
411  return names;
412 }

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 803 of file GEOObjects.cpp.

805 {
806  GeoLib::GeoObject const* geo_obj(
807  getGeoObject(geo_name, GeoLib::GEOTYPE::POINT, geo_obj_name));
808 
809  if (!geo_obj)
810  {
811  geo_obj =
812  getGeoObject(geo_name, GeoLib::GEOTYPE::POLYLINE, geo_obj_name);
813  }
814 
815  if (!geo_obj)
816  {
817  geo_obj =
818  getGeoObject(geo_name, GeoLib::GEOTYPE::SURFACE, geo_obj_name);
819  }
820 
821  if (!geo_obj)
822  {
823  DBUG(
824  "GEOObjects::getGeoObject(): Could not find '{:s}' in geometry "
825  "{:s}.",
826  geo_obj_name, geo_name);
827  }
828  return geo_obj;
829 }
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:746

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 746 of file GEOObjects.cpp.

750 {
751  GeoLib::GeoObject* geo_obj(nullptr);
752  switch (type)
753  {
755  {
756  GeoLib::PointVec const* pnt_vec(getPointVecObj(geo_name));
757  if (pnt_vec)
758  {
759  geo_obj = const_cast<GeoLib::GeoObject*>(
760  dynamic_cast<GeoLib::GeoObject const*>(
761  pnt_vec->getElementByName(geo_obj_name)));
762  }
763  break;
764  }
766  {
767  GeoLib::PolylineVec const* ply_vec(getPolylineVecObj(geo_name));
768  if (ply_vec)
769  {
770  geo_obj = const_cast<GeoLib::GeoObject*>(
771  dynamic_cast<GeoLib::GeoObject const*>(
772  ply_vec->getElementByName(geo_obj_name)));
773  }
774  break;
775  }
777  {
778  GeoLib::SurfaceVec const* sfc_vec(getSurfaceVecObj(geo_name));
779  if (sfc_vec)
780  {
781  geo_obj = const_cast<GeoLib::GeoObject*>(
782  dynamic_cast<GeoLib::GeoObject const*>(
783  sfc_vec->getElementByName(geo_obj_name)));
784  }
785  break;
786  }
787  default:
788  ERR("GEOObjects::getGeoObject(): geometric type not handled.");
789  return nullptr;
790  };
791 
792  if (!geo_obj)
793  {
794  DBUG(
795  "GEOObjects::getGeoObject(): Could not find {:s} '{:s}' in "
796  "geometry.",
798  geo_obj_name);
799  }
800  return geo_obj;
801 }
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 deletin...
Definition: PointVec.h:39
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 210 of file GEOObjects.cpp.

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

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 227 of file GEOObjects.cpp.

228 {
229  std::size_t size(_ply_vecs.size());
230  for (std::size_t i = 0; i < size; i++)
231  {
232  if (_ply_vecs[i]->getName() == name)
233  {
234  return _ply_vecs[i];
235  }
236  }
237 
238  DBUG("GEOObjects::getPolylineVecObj() - No entry found with name '{:s}'.",
239  name);
240  return nullptr;
241 }

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 390 of file GEOObjects.cpp.

391 {
392  for (auto point : _pnt_vecs)
393  {
394  if (point->getType() == PointVec::PointType::STATION)
395  {
396  names.push_back(point->getName());
397  }
398  }
399 }

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 307 of file GEOObjects.cpp.

309 {
310  std::size_t size(_sfc_vecs.size());
311  for (std::size_t i = 0; i < size; i++)
312  {
313  if (_sfc_vecs[i]->getName() == name)
314  {
315  return _sfc_vecs[i]->getVector();
316  }
317  }
318  DBUG("GEOObjects::getSurfaceVec() - No entry found with name '{:s}'.",
319  name);
320  return nullptr;
321 }

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 341 of file GEOObjects.cpp.

342 {
343  std::size_t size(_sfc_vecs.size());
344  for (std::size_t i = 0; i < size; i++)
345  {
346  if (_sfc_vecs[i]->getName() == name)
347  {
348  return _sfc_vecs[i];
349  }
350  }
351  DBUG("GEOObjects::getSurfaceVecObj() - No entry found with name '{:s}'.",
352  name);
353  return nullptr;
354 }

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 369 of file GEOObjects.cpp.

370 {
371  // search dependent data structures (Polyline)
372  for (auto polyline : _ply_vecs)
373  {
374  if (polyline->getName() == name)
375  {
376  return true;
377  }
378  }
379  for (auto surface : _sfc_vecs)
380  {
381  if (surface->getName() == name)
382  {
383  return true;
384  }
385  }
386 
387  return false;
388 }

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 356 of file GEOObjects.cpp.

357 {
358  std::vector<std::string> const existing_names = getGeometryNames();
359  auto const& unique_name = BaseLib::getUniqueName(existing_names, name);
360 
361  if (unique_name != name)
362  {
363  name = unique_name;
364  return false;
365  }
366  return true;
367 }
std::vector< std::string > getGeometryNames() const
Returns the names of all geometry vectors.
Definition: GEOObjects.cpp:401
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 435 of file GEOObjects.cpp.

437 {
438  const std::size_t n_geo_names(geo_names.size());
439 
440  if (n_geo_names < 2)
441  {
442  return 2;
443  }
444 
445  std::vector<std::size_t> pnt_offsets(n_geo_names, 0);
446 
447  if (!mergePoints(geo_names, merged_geo_name, pnt_offsets))
448  {
449  return 1;
450  }
451 
452  mergePolylines(geo_names, merged_geo_name, pnt_offsets);
453 
454  mergeSurfaces(geo_names, merged_geo_name, pnt_offsets);
455 
456  return 0;
457 }
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:571
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:512
bool mergePoints(std::vector< std::string > const &geo_names, std::string &merged_geo_name, std::vector< std::size_t > &pnt_offsets)
Definition: GEOObjects.cpp:459

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 459 of file GEOObjects.cpp.

462 {
463  const std::size_t n_geo_names(geo_names.size());
464 
465  auto merged_points = std::make_unique<std::vector<GeoLib::Point*>>();
466  auto merged_pnt_names =
467  std::make_unique<std::map<std::string, std::size_t>>();
468 
469  for (std::size_t j(0); j < n_geo_names; ++j)
470  {
471  GeoLib::PointVec const* const pnt_vec(
472  this->getPointVecObj(geo_names[j]));
473  if (pnt_vec == nullptr)
474  {
475  continue;
476  }
477  const std::vector<GeoLib::Point*>* pnts(pnt_vec->getVector());
478  if (pnts == nullptr)
479  {
480  return false;
481  }
482 
483  // do not consider stations
484  if (dynamic_cast<GeoLib::Station*>((*pnts)[0]))
485  {
486  continue;
487  }
488 
489  std::size_t const n_pnts(pnts->size());
490  for (std::size_t k(0); k < n_pnts; ++k)
491  {
492  merged_points->push_back(
493  new GeoLib::Point(*(*pnts)[k], pnt_offsets[j] + k));
494  std::string const& item_name(pnt_vec->getItemNameByID(k));
495  if (!item_name.empty())
496  {
497  merged_pnt_names->insert(
498  std::make_pair(item_name, pnt_offsets[j] + k));
499  }
500  }
501  if (n_geo_names - 1 > j)
502  {
503  pnt_offsets[j + 1] = n_pnts + pnt_offsets[j];
504  }
505  }
506 
507  addPointVec(std::move(merged_points), merged_geo_name,
508  std::move(merged_pnt_names), 1e-6);
509  return true;
510 }
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 512 of file GEOObjects.cpp.

515 {
516  const std::size_t n_geo_names(geo_names.size());
517  std::vector<std::size_t> ply_offsets(n_geo_names, 0);
518 
519  auto merged_polylines = std::make_unique<std::vector<GeoLib::Polyline*>>();
520  auto merged_ply_names =
521  std::make_unique<std::map<std::string, std::size_t>>();
522 
523  std::vector<GeoLib::Point*> const* merged_points(
524  this->getPointVecObj(merged_geo_name)->getVector());
525  std::vector<std::size_t> const& id_map(
526  this->getPointVecObj(merged_geo_name)->getIDMap());
527 
528  for (std::size_t j(0); j < n_geo_names; j++)
529  {
530  const std::vector<GeoLib::Polyline*>* plys(
531  this->getPolylineVec(geo_names[j]));
532  if (plys)
533  {
534  std::string tmp_name;
535  for (std::size_t k(0); k < plys->size(); k++)
536  {
537  auto* kth_ply_new(new GeoLib::Polyline(*merged_points));
538  GeoLib::Polyline const* const kth_ply_old((*plys)[k]);
539  const std::size_t size_of_kth_ply(
540  kth_ply_old->getNumberOfPoints());
541  // copy point ids from old ply to new ply (considering the
542  // offset)
543  for (std::size_t i(0); i < size_of_kth_ply; i++)
544  {
545  kth_ply_new->addPoint(
546  id_map[pnt_offsets[j] + kth_ply_old->getPointID(i)]);
547  }
548  merged_polylines->push_back(kth_ply_new);
549  if (this->getPolylineVecObj(geo_names[j])
550  ->getNameOfElementByID(k, tmp_name))
551  {
552  merged_ply_names->insert(
553  std::pair<std::string, std::size_t>(
554  tmp_name, ply_offsets[j] + k));
555  }
556  }
557  if (n_geo_names - 1 > j)
558  {
559  ply_offsets[j + 1] = plys->size() + ply_offsets[j];
560  }
561  }
562  }
563 
564  if (!merged_polylines->empty())
565  {
566  this->addPolylineVec(std::move(merged_polylines), merged_geo_name,
567  std::move(merged_ply_names));
568  }
569 }
const std::vector< Polyline * > * getPolylineVec(const std::string &name) const
Definition: GEOObjects.cpp:210
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 571 of file GEOObjects.cpp.

574 {
575  std::vector<GeoLib::Point*> const* merged_points(
576  this->getPointVecObj(merged_geo_name)->getVector());
577  std::vector<std::size_t> const& id_map(
578  this->getPointVecObj(merged_geo_name)->getIDMap());
579 
580  const std::size_t n_geo_names(geo_names.size());
581  std::vector<std::size_t> sfc_offsets(n_geo_names, 0);
582  auto merged_sfcs = std::make_unique<std::vector<GeoLib::Surface*>>();
583  auto merged_sfc_names =
584  std::make_unique<std::map<std::string, std::size_t>>();
585  for (std::size_t j(0); j < n_geo_names; j++)
586  {
587  const std::vector<GeoLib::Surface*>* sfcs(
588  this->getSurfaceVec(geo_names[j]));
589  if (sfcs)
590  {
591  std::string tmp_name;
592  for (std::size_t k(0); k < sfcs->size(); k++)
593  {
594  auto* kth_sfc_new(new GeoLib::Surface(*merged_points));
595  GeoLib::Surface const* const kth_sfc_old((*sfcs)[k]);
596  const std::size_t size_of_kth_sfc(
597  kth_sfc_old->getNumberOfTriangles());
598  // clone surface elements using new ids
599  for (std::size_t i(0); i < size_of_kth_sfc; i++)
600  {
601  const GeoLib::Triangle* tri((*kth_sfc_old)[i]);
602  const std::size_t id0(id_map[pnt_offsets[j] + (*tri)[0]]);
603  const std::size_t id1(id_map[pnt_offsets[j] + (*tri)[1]]);
604  const std::size_t id2(id_map[pnt_offsets[j] + (*tri)[2]]);
605  kth_sfc_new->addTriangle(id0, id1, id2);
606  }
607  merged_sfcs->push_back(kth_sfc_new);
608 
609  if (this->getSurfaceVecObj(geo_names[j])
610  ->getNameOfElementByID(k, tmp_name))
611  {
612  merged_sfc_names->insert(
613  std::pair<std::string, std::size_t>(
614  tmp_name, sfc_offsets[j] + k));
615  }
616  }
617  if (n_geo_names - 1 > j)
618  {
619  sfc_offsets[j + 1] = sfcs->size() + sfc_offsets[j];
620  }
621  }
622  }
623  if (!merged_sfcs->empty())
624  {
625  this->addSurfaceVec(std::move(merged_sfcs), merged_geo_name,
626  std::move(merged_sfc_names));
627  }
628 }
const std::vector< Surface * > * getSurfaceVec(const std::string &name) const
Returns the surface vector with the given name as a const.
Definition: GEOObjects.cpp:307
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:369

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 243 of file GEOObjects.cpp.

244 {
245  _callbacks->removePolylineVec(name);
246  for (auto it = _ply_vecs.begin(); it != _ply_vecs.end(); ++it)
247  {
248  if ((*it)->getName() == name)
249  {
250  delete *it;
251  _ply_vecs.erase(it);
252  return true;
253  }
254  }
255 
256  DBUG("GEOObjects::removePolylineVec() - No entry found with name '{:s}'.",
257  name);
258  return false;
259 }

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 323 of file GEOObjects.cpp.

324 {
325  _callbacks->removeSurfaceVec(name);
326  for (auto it(_sfc_vecs.begin()); it != _sfc_vecs.end(); ++it)
327  {
328  if ((*it)->getName() == name)
329  {
330  delete *it;
331  _sfc_vecs.erase(it);
332  return true;
333  }
334  }
335 
336  DBUG("GEOObjects::removeSurfaceVec() - No entry found with name '{:s}'.",
337  name);
338  return false;
339 }

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 630 of file GEOObjects.cpp.

632 {
633  _callbacks->renameGeometry(old_name, new_name);
634  for (auto* pnt_vec : _pnt_vecs)
635  {
636  if (pnt_vec->getName() == old_name)
637  {
638  pnt_vec->setName(new_name);
639  break;
640  }
641  }
642  for (auto* ply_vec : _ply_vecs)
643  {
644  if (ply_vec->getName() == old_name)
645  {
646  ply_vec->setName(new_name);
647  break;
648  }
649  }
650  for (auto* sfc_vec : _sfc_vecs)
651  {
652  if (sfc_vec->getName() == old_name)
653  {
654  sfc_vec->setName(new_name);
655  break;
656  }
657  }
658 }

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: