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::vector< Point * > &&points, std::string &name, PointVec::NameIdMap &&pnt_id_name_map, double const eps=std::sqrt(std::numeric_limits< double >::epsilon()))
 
void addPointVec (std::vector< Point * > &&points, std::string &name, double const 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::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::vector< Polyline * > &&lines, std::string const &name, PolylineVec::NameIdMap &&ply_names)
 
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::vector< Surface * > &&sfc, const std::string &name, SurfaceVec::NameIdMap &&sfc_names)
 
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::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)
 

Private Attributes

std::vector< PointVec * > _pnt_vecs
 
std::vector< PolylineVec * > _ply_vecs
 
std::vector< SurfaceVec * > _sfc_vecs
 

Constructor & Destructor Documentation

◆ GEOObjects()

GeoLib::GEOObjects::GEOObjects ( )
default

constructor

◆ ~GEOObjects()

GeoLib::GEOObjects::~GEOObjects ( )

destructor

Definition at line 41 of file GEOObjects.cpp.

42 {
43  // delete all SurfaceVecs, PolylineVec, and PointVecs
45 }
std::vector< PointVec * > _pnt_vecs
Definition: GEOObjects.h:363
std::vector< PolylineVec * > _ply_vecs
Definition: GEOObjects.h:365
std::vector< SurfaceVec * > _sfc_vecs
Definition: GEOObjects.h:367
void cleanupVectorElements(std::vector< T * > &items)
Definition: Algorithm.h:300

References _ply_vecs, _pnt_vecs, _sfc_vecs, and BaseLib::cleanupVectorElements().

Member Function Documentation

◆ addPointVec() [1/2]

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

Adds a vector of points with the given name to GEOObjects. This is an overloaded version without the need to pass a name-to-id-map.

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

Definition at line 66 of file GEOObjects.cpp.

68 {
69  addPointVec(std::move(points), name, {}, eps);
70 }
void addPointVec(std::vector< Point * > &&points, std::string &name, PointVec::NameIdMap &&pnt_id_name_map, double const eps=std::sqrt(std::numeric_limits< double >::epsilon()))
Definition: GEOObjects.cpp:47

References addPointVec(), and MaterialPropertyLib::name.

◆ addPointVec() [2/2]

void GeoLib::GEOObjects::addPointVec ( std::vector< Point * > &&  points,
std::string &  name,
PointVec::NameIdMap &&  pnt_id_name_map,
double const  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 47 of file GEOObjects.cpp.

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

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

Referenced by FileIO::PetrelInterface::PetrelInterface(), addPointVec(), convertMeshNodesToGeometry(), anonymous_namespace{convertMeshToGeo.cpp}::convertMeshNodesToGeoPoints(), convertPoints(), FileIO::SwmmInterface::convertSwmmInputToGeometry(), createGeometries(), GeoLib::Grid< POINT >::createGridGeometry(), FileIO::createSurface(), GeoLib::DuplicateGeometry::duplicate(), generatePolylineGeometry(), generateQuadGeometry(), generateSinglePointGeometry(), 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::vector< Polyline * > &&  lines,
std::string const &  name,
PolylineVec::NameIdMap &&  ply_names 
)

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

155 {
156  auto lines_end = std::remove_if(
157  lines.begin(), lines.end(),
158  [](auto const* polyline) { return polyline->getNumberOfPoints() < 2; });
159  lines.erase(lines_end, lines.end());
160 
161  if (lines.empty())
162  {
163  return;
164  }
165 
166  _ply_vecs.push_back(
167  new PolylineVec(name, std::move(lines), std::move(ply_names)));
168  _callbacks->addPolylineVec(name);
169 }
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::SwmmInterface::convertSwmmInputToGeometry(), createGeometries(), GeoLib::Grid< POINT >::createGridGeometry(), FileIO::createSurface(), GeoLib::DuplicateGeometry::duplicate(), generatePolylineGeometry(), generateQuadGeometry(), 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::vector< Point * > &&  stations,
std::string &  name 
)

◆ addSurfaceVec()

void GeoLib::GEOObjects::addSurfaceVec ( std::vector< Surface * > &&  sfc,
const std::string &  name,
SurfaceVec::NameIdMap &&  sfc_names 
)

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

Definition at line 240 of file GEOObjects.cpp.

243 {
244  _sfc_vecs.push_back(
245  new SurfaceVec(name, std::move(sfc), std::move(sfc_names)));
246  _callbacks->addSurfaceVec(name);
247 }
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 171 of file GEOObjects.cpp.

173 {
174  // find an already existing PolylineVec object the given polylines will be
175  // appended to
176  auto polyline_vec_it = findVectorByName(_ply_vecs, name);
177  if (polyline_vec_it == _ply_vecs.end())
178  {
179  return false;
180  }
181  for (auto* polyline : polylines)
182  {
183  (*polyline_vec_it)->push_back(polyline);
184  }
185  _callbacks->appendPolylineVec(name);
186  return true;
187 }
auto findVectorByName(Container const &container, std::string const &name)
Definition: GEOObjects.cpp:28

References _callbacks, _ply_vecs, GeoLib::findVectorByName(), 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 249 of file GEOObjects.cpp.

251 {
252  auto surface_vec_to_append_it = findVectorByName(_sfc_vecs, name);
253  if (surface_vec_to_append_it != _sfc_vecs.end())
254  {
255  for (auto& surface : surfaces)
256  {
257  (*surface_vec_to_append_it)->push_back(surface);
258  }
259  _callbacks->appendSurfaceVec(name);
260  return true;
261  }
262 
263  // the copy is needed because addSurfaceVec is passing it to SurfaceVec
264  // ctor, which needs write access to the surface vector.
265  std::vector<GeoLib::Surface*> sfc(begin(surfaces), end(surfaces));
266  addSurfaceVec(std::move(sfc), name, SurfaceVec::NameIdMap{});
267  return false;
268 }
void addSurfaceVec(std::vector< Surface * > &&sfc, const std::string &name, SurfaceVec::NameIdMap &&sfc_names)
Definition: GEOObjects.cpp:240

References _callbacks, _sfc_vecs, addSurfaceVec(), GeoLib::findVectorByName(), 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 748 of file GEOObjects.cpp.

749 {
750  std::size_t const size(_pnt_vecs.size());
751  auto const it = findVectorByName(_pnt_vecs, geometry_name);
752  if (it != _pnt_vecs.end())
753  {
754  return std::distance(_pnt_vecs.begin(), it);
755  }
756 
757  // HACK for enabling conversion of files without loading the associated
758  // geometry
759  if (size > 0 && _pnt_vecs[0]->getName() == "conversionTestRun#1")
760  {
761  return 1;
762  }
763 
764  return std::numeric_limits<std::size_t>::max();
765 }
std::string getName(std::string const &line)
Returns the name/title from the "Zone"-description.

References _pnt_vecs, GeoLib::findVectorByName(), 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 355 of file GEOObjects.cpp.

358 {
359  std::string name;
360  switch (type)
361  {
363  this->getPointVecObj(geometry_name)->getNameOfElementByID(id, name);
364  break;
366  this->getPolylineVecObj(geometry_name)
367  ->getNameOfElementByID(id, name);
368  break;
370  this->getSurfaceVecObj(geometry_name)
371  ->getNameOfElementByID(id, name);
372  }
373  return name;
374 }
const PointVec * getPointVecObj(const std::string &name) const
Definition: GEOObjects.cpp:85
SurfaceVec * getSurfaceVecObj(const std::string &name)
Returns the surface vector with the given name.
Definition: GEOObjects.h:211
const PolylineVec * getPolylineVecObj(const std::string &name) const
Definition: GEOObjects.cpp:206
bool getNameOfElementByID(std::size_t id, std::string &element_name) const
Definition: TemplateVec.h:151

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

343 {
344  std::vector<std::string> names;
345  for (auto point : _pnt_vecs)
346  {
347  if (point->getType() == PointVec::PointType::POINT)
348  {
349  names.push_back(point->getName());
350  }
351  }
352  return names;
353 }

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

Referenced by GMSHPrefsDialog::GMSHPrefsDialog(), MergeGeometriesDialog::MergeGeometriesDialog(), OGSFileConverter::convertGML2GLI(), FileIO::createSurface(), 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 720 of file GEOObjects.cpp.

722 {
723  GeoLib::GeoObject const* geo_obj(
724  getGeoObject(geo_name, GeoLib::GEOTYPE::POINT, geo_obj_name));
725 
726  if (!geo_obj)
727  {
728  geo_obj =
729  getGeoObject(geo_name, GeoLib::GEOTYPE::POLYLINE, geo_obj_name);
730  }
731 
732  if (!geo_obj)
733  {
734  geo_obj =
735  getGeoObject(geo_name, GeoLib::GEOTYPE::SURFACE, geo_obj_name);
736  }
737 
738  if (!geo_obj)
739  {
740  DBUG(
741  "GEOObjects::getGeoObject(): Could not find '{:s}' in geometry "
742  "{:s}.",
743  geo_obj_name, geo_name);
744  }
745  return geo_obj;
746 }
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:663

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

667 {
668  GeoLib::GeoObject* geo_obj(nullptr);
669  switch (type)
670  {
672  {
673  GeoLib::PointVec const* pnt_vec(getPointVecObj(geo_name));
674  if (pnt_vec)
675  {
676  geo_obj = const_cast<GeoLib::GeoObject*>(
677  dynamic_cast<GeoLib::GeoObject const*>(
678  pnt_vec->getElementByName(geo_obj_name)));
679  }
680  break;
681  }
683  {
684  GeoLib::PolylineVec const* ply_vec(getPolylineVecObj(geo_name));
685  if (ply_vec)
686  {
687  geo_obj = const_cast<GeoLib::GeoObject*>(
688  dynamic_cast<GeoLib::GeoObject const*>(
689  ply_vec->getElementByName(geo_obj_name)));
690  }
691  break;
692  }
694  {
695  GeoLib::SurfaceVec const* sfc_vec(getSurfaceVecObj(geo_name));
696  if (sfc_vec)
697  {
698  geo_obj = const_cast<GeoLib::GeoObject*>(
699  dynamic_cast<GeoLib::GeoObject const*>(
700  sfc_vec->getElementByName(geo_obj_name)));
701  }
702  break;
703  }
704  default:
705  ERR("GEOObjects::getGeoObject(): geometric type not handled.");
706  return nullptr;
707  };
708 
709  if (!geo_obj)
710  {
711  DBUG(
712  "GEOObjects::getGeoObject(): Could not find {:s} '{:s}' in "
713  "geometry.",
715  geo_obj_name);
716  }
717  return geo_obj;
718 }
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:41
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 292 of file GEOObjects.h.

292 { 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 119 of file GEOObjects.h.

120  {
121  return const_cast<PointVec*>(static_cast<const GEOObjects&>(*this).
123  }

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

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

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(), generatePolylineGeometry(), generateQuadGeometry(), 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 294 of file GEOObjects.h.

294 { 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 189 of file GEOObjects.cpp.

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

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 179 of file GEOObjects.h.

180  {
181  return const_cast<PolylineVec*>(static_cast<const GEOObjects&>(*this).
183  }

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

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

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

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

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

332 {
333  for (auto point : _pnt_vecs)
334  {
335  if (point->getType() == PointVec::PointType::STATION)
336  {
337  names.push_back(point->getName());
338  }
339  }
340 }

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 296 of file GEOObjects.h.

296 { 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 270 of file GEOObjects.cpp.

272 {
273  auto surface_vec_it = findVectorByName(_sfc_vecs, name);
274  if (surface_vec_it != _sfc_vecs.end())
275  {
276  return &(*surface_vec_it)->getVector();
277  }
278  DBUG("GEOObjects::getSurfaceVec() - No entry found with name '{:s}'.",
279  name);
280  return nullptr;
281 }

References _sfc_vecs, DBUG(), GeoLib::findVectorByName(), 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 299 of file GEOObjects.cpp.

300 {
301  auto surface_vec_it = findVectorByName(_sfc_vecs, name);
302  if (surface_vec_it != _sfc_vecs.end())
303  {
304  return *surface_vec_it;
305  }
306  DBUG("GEOObjects::getSurfaceVecObj() - No entry found with name '{:s}'.",
307  name);
308  return nullptr;
309 }

References _sfc_vecs, DBUG(), GeoLib::findVectorByName(), 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 324 of file GEOObjects.cpp.

325 {
326  // search for dependent PolylineVecs or SurfaceVecs
327  return findVectorByName(_ply_vecs, name) != _ply_vecs.end() ||
329 }

References _ply_vecs, _sfc_vecs, GeoLib::findVectorByName(), 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 311 of file GEOObjects.cpp.

312 {
313  std::vector<std::string> const existing_names = getGeometryNames();
314  auto const& unique_name = BaseLib::getUniqueName(existing_names, name);
315 
316  if (unique_name != name)
317  {
318  name = unique_name;
319  return false;
320  }
321  return true;
322 }
std::vector< std::string > getGeometryNames() const
Returns the names of all geometry vectors.
Definition: GEOObjects.cpp:342
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 376 of file GEOObjects.cpp.

378 {
379  const std::size_t n_geo_names(geo_names.size());
380 
381  if (n_geo_names < 2)
382  {
383  return 2;
384  }
385 
386  std::vector<std::size_t> pnt_offsets(n_geo_names, 0);
387 
388  if (!mergePoints(geo_names, merged_geo_name, pnt_offsets))
389  {
390  return 1;
391  }
392 
393  mergePolylines(geo_names, merged_geo_name, pnt_offsets);
394 
395  mergeSurfaces(geo_names, merged_geo_name, pnt_offsets);
396 
397  return 0;
398 }
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:503
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:448
bool mergePoints(std::vector< std::string > const &geo_names, std::string &merged_geo_name, std::vector< std::size_t > &pnt_offsets)
Definition: GEOObjects.cpp:400

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

403 {
404  const std::size_t n_geo_names(geo_names.size());
405 
406  std::vector<GeoLib::Point*> merged_points;
407  PointVec::NameIdMap merged_pnt_names;
408 
409  for (std::size_t j(0); j < n_geo_names; ++j)
410  {
411  GeoLib::PointVec const* const pnt_vec(
412  this->getPointVecObj(geo_names[j]));
413  if (pnt_vec == nullptr)
414  {
415  continue;
416  }
417  auto const& pnts(pnt_vec->getVector());
418 
419  // do not consider stations
420  if (dynamic_cast<GeoLib::Station*>(pnts[0]))
421  {
422  continue;
423  }
424 
425  std::size_t const n_pnts(pnts.size());
426  for (std::size_t k(0); k < n_pnts; ++k)
427  {
428  merged_points.push_back(
429  new GeoLib::Point(*pnts[k], pnt_offsets[j] + k));
430  std::string const& item_name(pnt_vec->getItemNameByID(k));
431  if (!item_name.empty())
432  {
433  merged_pnt_names.insert(
434  std::make_pair(item_name, pnt_offsets[j] + k));
435  }
436  }
437  if (n_geo_names - 1 > j)
438  {
439  pnt_offsets[j + 1] = n_pnts + pnt_offsets[j];
440  }
441  }
442 
443  addPointVec(std::move(merged_points), merged_geo_name,
444  std::move(merged_pnt_names), 1e-6);
445  return true;
446 }
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 448 of file GEOObjects.cpp.

451 {
452  const std::size_t n_geo_names(geo_names.size());
453  std::vector<std::size_t> ply_offsets(n_geo_names, 0);
454 
455  std::vector<GeoLib::Polyline*> merged_polylines;
456  PolylineVec::NameIdMap merged_ply_names;
457 
458  auto const& merged_points(getPointVecObj(merged_geo_name)->getVector());
459  std::vector<std::size_t> const& id_map(
460  this->getPointVecObj(merged_geo_name)->getIDMap());
461 
462  for (std::size_t j(0); j < n_geo_names; j++)
463  {
464  const std::vector<GeoLib::Polyline*>* plys(
465  this->getPolylineVec(geo_names[j]));
466  if (plys)
467  {
468  std::string tmp_name;
469  for (std::size_t k(0); k < plys->size(); k++)
470  {
471  auto* kth_ply_new(new GeoLib::Polyline(merged_points));
472  GeoLib::Polyline const* const kth_ply_old((*plys)[k]);
473  const std::size_t size_of_kth_ply(
474  kth_ply_old->getNumberOfPoints());
475  // copy point ids from old ply to new ply (considering the
476  // offset)
477  for (std::size_t i(0); i < size_of_kth_ply; i++)
478  {
479  kth_ply_new->addPoint(
480  id_map[pnt_offsets[j] + kth_ply_old->getPointID(i)]);
481  }
482  merged_polylines.push_back(kth_ply_new);
483  if (this->getPolylineVecObj(geo_names[j])
484  ->getNameOfElementByID(k, tmp_name))
485  {
486  merged_ply_names.emplace(tmp_name, ply_offsets[j] + k);
487  }
488  }
489  if (n_geo_names - 1 > j)
490  {
491  ply_offsets[j + 1] = plys->size() + ply_offsets[j];
492  }
493  }
494  }
495 
496  if (!merged_polylines.empty())
497  {
498  this->addPolylineVec(std::move(merged_polylines), merged_geo_name,
499  std::move(merged_ply_names));
500  }
501 }
void addPolylineVec(std::vector< Polyline * > &&lines, std::string const &name, PolylineVec::NameIdMap &&ply_names)
Definition: GEOObjects.cpp:152
const std::vector< Polyline * > * getPolylineVec(const std::string &name) const
Definition: GEOObjects.cpp:189
Class Polyline consists mainly of a reference to a point vector and a vector that stores the indices ...
Definition: Polyline.h:53

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

506 {
507  auto const& merged_points(getPointVecObj(merged_geo_name)->getVector());
508  std::vector<std::size_t> const& id_map(
509  this->getPointVecObj(merged_geo_name)->getIDMap());
510 
511  const std::size_t n_geo_names(geo_names.size());
512  std::vector<std::size_t> sfc_offsets(n_geo_names, 0);
513  std::vector<GeoLib::Surface*> merged_sfcs;
514  SurfaceVec::NameIdMap merged_sfc_names;
515  for (std::size_t j(0); j < n_geo_names; j++)
516  {
517  const std::vector<GeoLib::Surface*>* sfcs(
518  this->getSurfaceVec(geo_names[j]));
519  if (sfcs)
520  {
521  std::string tmp_name;
522  for (std::size_t k(0); k < sfcs->size(); k++)
523  {
524  auto* kth_sfc_new(new GeoLib::Surface(merged_points));
525  GeoLib::Surface const* const kth_sfc_old((*sfcs)[k]);
526  const std::size_t size_of_kth_sfc(
527  kth_sfc_old->getNumberOfTriangles());
528  // clone surface elements using new ids
529  for (std::size_t i(0); i < size_of_kth_sfc; i++)
530  {
531  const GeoLib::Triangle* tri((*kth_sfc_old)[i]);
532  const std::size_t id0(id_map[pnt_offsets[j] + (*tri)[0]]);
533  const std::size_t id1(id_map[pnt_offsets[j] + (*tri)[1]]);
534  const std::size_t id2(id_map[pnt_offsets[j] + (*tri)[2]]);
535  kth_sfc_new->addTriangle(id0, id1, id2);
536  }
537  merged_sfcs.push_back(kth_sfc_new);
538 
539  if (this->getSurfaceVecObj(geo_names[j])
540  ->getNameOfElementByID(k, tmp_name))
541  {
542  merged_sfc_names.emplace(tmp_name, sfc_offsets[j] + k);
543  }
544  }
545  if (n_geo_names - 1 > j)
546  {
547  sfc_offsets[j + 1] = sfcs->size() + sfc_offsets[j];
548  }
549  }
550  }
551  if (!merged_sfcs.empty())
552  {
553  this->addSurfaceVec(std::move(merged_sfcs), merged_geo_name,
554  std::move(merged_sfc_names));
555  }
556 }
const std::vector< Surface * > * getSurfaceVec(const std::string &name) const
Returns the surface vector with the given name as a const.
Definition: GEOObjects.cpp:270
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 98 of file GEOObjects.cpp.

99 {
100  if (isPntVecUsed(name))
101  {
102  DBUG(
103  "GEOObjects::removePointVec() - There are still Polylines or "
104  "Surfaces depending on these points.");
105  return false;
106  }
107 
108  for (auto it(_pnt_vecs.begin()); it != _pnt_vecs.end(); ++it)
109  {
110  if ((*it)->getName() == name)
111  {
112  _callbacks->removePointVec(name);
113  delete *it;
114  _pnt_vecs.erase(it);
115  return true;
116  }
117  }
118  DBUG("GEOObjects::removePointVec() - No entry found with name '{:s}'.",
119  name);
120  return false;
121 }
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:324

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

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

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 139 of file GEOObjects.h.

140  {
141  _callbacks->removeStationVec(name);
142  return removePointVec(name);
143  }
bool removePointVec(const std::string &name)
Definition: GEOObjects.cpp:98

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

284 {
285  _callbacks->removeSurfaceVec(name);
286  auto const it = findVectorByName(_sfc_vecs, name);
287  if (it != _sfc_vecs.end())
288  {
289  delete *it;
290  _sfc_vecs.erase(it);
291  return true;
292  }
293 
294  DBUG("GEOObjects::removeSurfaceVec() - No entry found with name '{:s}'.",
295  name);
296  return false;
297 }

References _callbacks, _sfc_vecs, DBUG(), GeoLib::findVectorByName(), 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 558 of file GEOObjects.cpp.

560 {
561  _callbacks->renameGeometry(old_name, new_name);
562 
563  auto rename = [&old_name, &new_name](auto const& container)
564  {
565  auto it = findVectorByName(container, old_name);
566  if (it != container.end())
567  {
568  (*it)->setName(new_name);
569  }
570  };
571 
572  rename(_pnt_vecs);
573  rename(_ply_vecs);
574  rename(_sfc_vecs);
575 }

References _callbacks, _ply_vecs, _pnt_vecs, _sfc_vecs, and GeoLib::findVectorByName().

Referenced by FileIO::createSurface().

Member Data Documentation

◆ _callbacks

◆ _ply_vecs

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

vector manages pointers to PolylineVec objects

Definition at line 365 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
private

◆ _sfc_vecs

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

vector manages pointers to SurfaceVec objects

Definition at line 367 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 300 of file GEOObjects.h.

◆ addSurfaceVecCallback

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

Definition at line 309 of file GEOObjects.h.

◆ appendPolylineVecCallback

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

Definition at line 303 of file GEOObjects.h.

◆ appendSurfaceVecCallback

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

Definition at line 312 of file GEOObjects.h.

◆ removePolylineVecCallback

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

Definition at line 306 of file GEOObjects.h.

◆ removeSurfaceVecCallback

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

Definition at line 315 of file GEOObjects.h.


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