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 56 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.
 
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.
 
const std::vector< GeoLib::Point * > * getStationVec (const std::string &name) const
 Returns the station vector with the given name.
 
bool removeStationVec (const std::string &name)
 Removes the station vector with the given name from GEOObjects.
 
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.
 
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.
 
SurfaceVecgetSurfaceVecObj (const std::string &name)
 Returns the surface vector with the given name.
 
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.
 
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.
 
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
 
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.
 
 GEOObjects ()
 
 ~GEOObjects ()
 
std::size_t exists (const std::string &geometry_name) const
 
bool isPntVecUsed (const std::string &name) const
 
std::vector< PointVec * > const & getPoints () const
 Read access to points w/o using a name.
 
std::vector< PolylineVec * > const & getPolylines () const
 Read access to polylines w/o using a name.
 
std::vector< SurfaceVec * > const & getSurfaces () const
 Read access to surfaces w/o using a name.
 

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

void 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:367
std::vector< PolylineVec * > _ply_vecs
Definition GEOObjects.h:369
std::vector< SurfaceVec * > _sfc_vecs
Definition GEOObjects.h:371
void cleanupVectorElements(std::vector< T * > &items)
Definition Algorithm.h:251

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()))

References addPointVec().

◆ 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(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:30
bool isUniquePointVecName(std::string &name) const
std::unique_ptr< Callbacks > _callbacks
Definition GEOObjects.h:303

References _callbacks, _pnt_vecs, DBUG(), isUniquePointVecName(), 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(), FileIO::GMSH::GMSHAdaptiveMeshDensity::getQuadTreeGeometry(), main(), mergeGeometries(), mergePoints(), FileIO::FEFLOWGeoInterface::readFEFLOWFile(), GeoLib::IO::XmlGmlInterface::readFile(), GeoLib::IO::BoostXmlGmlInterface::readFile(), FileIO::Legacy::readGLIFileV4(), FileIO::SHPInterface::readPoints(), FileIO::SHPInterface::readPolylines(), and FileIO::TetGenInterface::readTetGenGeometry().

◆ 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:27

References _callbacks, and _ply_vecs.

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

◆ addStationVec()

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

Adds a vector of stations with the given name and colour to GEOObjects.

Definition at line 123 of file GEOObjects.cpp.

125{
127 _pnt_vecs.push_back(new PointVec(name, std::move(stations),
130 _callbacks->addStationVec(name);
131}
std::map< std::string, std::size_t > NameIdMap
Definition TemplateVec.h:41

References _callbacks, _pnt_vecs, isUniquePointVecName(), and GeoLib::PointVec::STATION.

Referenced by FileIO::PetrelInterface::PetrelInterface(), convertPoints(), GeoLib::geoPointsToStations(), MainWindow::loadFile(), GeoLib::IO::XmlStnInterface::readFile(), FileIO::SHPInterface::readStations(), and FileIO::GMSH::GMSHInterface::writeGMSHInputFile().

◆ 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:28

References _callbacks, and _sfc_vecs.

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)

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

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)

References _callbacks, _sfc_vecs, addSurfaceVec(), and GeoLib::findVectorByName().

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

745{
746 if (auto const it = findVectorByName(_pnt_vecs, geometry_name);
747 it != _pnt_vecs.end())
748 {
749 return std::distance(_pnt_vecs.begin(), it);
750 }
751
752 // HACK for enabling conversion of files without loading the associated
753 // geometry
754 if (_pnt_vecs.size() > 0 &&
755 _pnt_vecs[0]->getName() == "conversionTestRun#1")
756 {
757 return 1;
758 }
759
760 return std::numeric_limits<std::size_t>::max();
761}

References _pnt_vecs, and GeoLib::findVectorByName().

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
SurfaceVec * getSurfaceVecObj(const std::string &name)
Returns the surface vector with the given name.
Definition GEOObjects.h:208
const PolylineVec * getPolylineVecObj(const std::string &name) const
bool getNameOfElementByID(std::size_t id, std::string &element_name) const

References GeoLib::TemplateVec< T >::getNameOfElementByID(), getPointVecObj(), getPolylineVecObj(), getSurfaceVecObj(), 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 const* point : _pnt_vecs)
346 {
347 if (point->getType() == PointVec::PointType::POINT)
348 {
349 names.push_back(point->getName());
350 }
351 }
352 return names;
353}
constexpr ranges::views::view_closure names
For an element of a range view return its name.
Definition Mesh.h:229

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

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

718{
719 GeoLib::GeoObject const* geo_obj(
720 getGeoObject(geo_name, GeoLib::GEOTYPE::POINT, geo_obj_name));
721
722 if (!geo_obj)
723 {
724 geo_obj =
725 getGeoObject(geo_name, GeoLib::GEOTYPE::POLYLINE, geo_obj_name);
726 }
727
728 if (!geo_obj)
729 {
730 geo_obj =
731 getGeoObject(geo_name, GeoLib::GEOTYPE::SURFACE, geo_obj_name);
732 }
733
734 if (!geo_obj)
735 {
736 DBUG(
737 "GEOObjects::getGeoObject(): Could not find '{:s}' in geometry "
738 "{:s}.",
739 geo_obj_name, geo_name);
740 }
741 return geo_obj;
742}
const GeoLib::GeoObject * getGeoObject(const std::string &geo_name, GeoLib::GEOTYPE type, const std::string &geo_obj_name) const

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

663{
664 GeoLib::GeoObject* geo_obj(nullptr);
665 switch (type)
666 {
668 {
669 GeoLib::PointVec const* pnt_vec(getPointVecObj(geo_name));
670 if (pnt_vec)
671 {
672 geo_obj = const_cast<GeoLib::GeoObject*>(
673 dynamic_cast<GeoLib::GeoObject const*>(
674 pnt_vec->getElementByName(geo_obj_name)));
675 }
676 break;
677 }
679 {
680 GeoLib::PolylineVec const* ply_vec(getPolylineVecObj(geo_name));
681 if (ply_vec)
682 {
683 geo_obj = const_cast<GeoLib::GeoObject*>(
684 dynamic_cast<GeoLib::GeoObject const*>(
685 ply_vec->getElementByName(geo_obj_name)));
686 }
687 break;
688 }
690 {
691 GeoLib::SurfaceVec const* sfc_vec(getSurfaceVecObj(geo_name));
692 if (sfc_vec)
693 {
694 geo_obj = const_cast<GeoLib::GeoObject*>(
695 dynamic_cast<GeoLib::GeoObject const*>(
696 sfc_vec->getElementByName(geo_obj_name)));
697 }
698 break;
699 }
700 default:
701 ERR("GEOObjects::getGeoObject(): geometric type not handled.");
702 return nullptr;
703 };
704
705 if (!geo_obj)
706 {
707 DBUG(
708 "GEOObjects::getGeoObject(): Could not find {:s} '{:s}' in "
709 "geometry.",
711 geo_obj_name);
712 }
713 return geo_obj;
714}
void ERR(fmt::format_string< Args... > fmt, Args &&... args)
Definition Logging.h:45
This class manages pointers to Points in a std::vector along with a name. It also handles the deletio...
Definition PointVec.h:36
The class TemplateVec takes a unique name and manages a std::vector of pointers to data elements of t...
Definition TemplateVec.h:38
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 297 of file GEOObjects.h.

297{ 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 115 of file GEOObjects.h.

116 {
117 return const_cast<PointVec*>(
118 static_cast<const GEOObjects&>(*this).getPointVecObj(name));
119 }

References getPointVecObj().

◆ 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(), and exists().

Referenced by GEOModels::addNameForElement(), GEOModels::addNameForObjectPoints(), GEOModels::addPointVec(), FileIO::GMSH::GMSHPolygonTree::checkIntersectionsSegmentExistingPolylines(), MeshToolsLib::convertMeshToGeo(), FileIO::SwmmInterface::convertSwmmInputToGeometry(), GeoLib::DuplicateGeometry::duplicate(), generatePolylineGeometry(), generateQuadGeometry(), GeoLib::geoPointsToStations(), getElementNameByID(), getGeoObject(), getPointVecObj(), FileIO::GMSH::GMSHAdaptiveMeshDensity::getQuadTreeGeometry(), 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 299 of file GEOObjects.h.

299{ 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}
std::string getName(std::string const &line)
Returns the name/title from the "Zone"-description.
constexpr int size(int const displacement_dim)
Vectorized tensor size for given displacement dimension.

References _ply_vecs, DBUG(), and getName().

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

177 {
178 return const_cast<PolylineVec*>(
179 static_cast<const GEOObjects&>(*this).getPolylineVecObj(name));
180 }

References getPolylineVecObj().

◆ 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(), and getName().

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::GMSH::GMSHPolygonTree::writeAdditionalPointData(), 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(), 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 const* 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 301 of file GEOObjects.h.

301{ 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(), and GeoLib::findVectorByName().

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(), and GeoLib::findVectorByName().

◆ 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() ||
328 findVectorByName(_sfc_vecs, name) != _sfc_vecs.end();
329}

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

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.
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(), and BaseLib::getUniqueName().

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 mergePoints(geo_names, merged_geo_name, pnt_offsets);
389
390 mergePolylines(geo_names, merged_geo_name, pnt_offsets);
391
392 mergeSurfaces(geo_names, merged_geo_name, pnt_offsets);
393
394 return 0;
395}
void mergeSurfaces(std::vector< std::string > const &geo_names, std::string const &merged_geo_name, std::vector< std::size_t > const &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 mergePoints(std::vector< std::string > const &geo_names, std::string &merged_geo_name, std::vector< std::size_t > &pnt_offsets)

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

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

◆ mergePoints()

void 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

Definition at line 397 of file GEOObjects.cpp.

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

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

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

502{
503 auto const& merged_points(getPointVecObj(merged_geo_name)->getVector());
504 std::vector<std::size_t> const& id_map(
505 this->getPointVecObj(merged_geo_name)->getIDMap());
506
507 const std::size_t n_geo_names(geo_names.size());
508 std::vector<std::size_t> sfc_offsets(n_geo_names, 0);
509 std::vector<GeoLib::Surface*> merged_sfcs;
510 SurfaceVec::NameIdMap merged_sfc_names;
511 for (std::size_t j(0); j < n_geo_names; j++)
512 {
513 const std::vector<GeoLib::Surface*>* sfcs(
514 this->getSurfaceVec(geo_names[j]));
515 if (sfcs)
516 {
517 std::string tmp_name;
518 for (std::size_t k(0); k < sfcs->size(); k++)
519 {
520 auto* kth_sfc_new(new GeoLib::Surface(merged_points));
521 GeoLib::Surface const* const kth_sfc_old((*sfcs)[k]);
522 const std::size_t size_of_kth_sfc(
523 kth_sfc_old->getNumberOfTriangles());
524 // clone surface elements using new ids
525 for (std::size_t i(0); i < size_of_kth_sfc; i++)
526 {
527 const GeoLib::Triangle* tri((*kth_sfc_old)[i]);
528 const std::size_t id0(id_map[pnt_offsets[j] + (*tri)[0]]);
529 const std::size_t id1(id_map[pnt_offsets[j] + (*tri)[1]]);
530 const std::size_t id2(id_map[pnt_offsets[j] + (*tri)[2]]);
531 kth_sfc_new->addTriangle(id0, id1, id2);
532 }
533 merged_sfcs.push_back(kth_sfc_new);
534
535 if (this->getSurfaceVecObj(geo_names[j])
536 ->getNameOfElementByID(k, tmp_name))
537 {
538 merged_sfc_names.emplace(tmp_name, sfc_offsets[j] + k);
539 }
540 }
541 if (n_geo_names - 1 > j)
542 {
543 sfc_offsets[j + 1] = sfcs->size() + sfc_offsets[j];
544 }
545 }
546 }
547 if (!merged_sfcs.empty())
548 {
549 this->addSurfaceVec(std::move(merged_sfcs), merged_geo_name,
550 std::move(merged_sfc_names));
551 }
552}
const std::vector< Surface * > * getSurfaceVec(const std::string &name) const
Returns the surface vector with the given name as a const.
A Surface is represented by Triangles. It consists of a reference to a vector of (pointers to) points...
Definition Surface.h:33
Class Triangle consists of a reference to a point vector and a vector that stores the indices in the ...
Definition Triangle.h:27

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

References _callbacks, _pnt_vecs, DBUG(), and isPntVecUsed().

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 auto it = std::find_if(_ply_vecs.begin(), _ply_vecs.end(),
226 [&name](PolylineVec const* const v)
227 { return v->getName() == name; });
228 if (it != _ply_vecs.end())
229 {
230 delete *it;
231 _ply_vecs.erase(it);
232 return true;
233 }
234
235 DBUG("GEOObjects::removePolylineVec() - No entry found with name '{:s}'.",
236 name);
237 return false;
238}

References _callbacks, _ply_vecs, and DBUG().

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

136 {
137 _callbacks->removeStationVec(name);
138 return removePointVec(name);
139 }
bool removePointVec(const std::string &name)

References _callbacks, 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(), and GeoLib::findVectorByName().

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

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

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 369 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 371 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 305 of file GEOObjects.h.

306 {};

◆ addSurfaceVecCallback

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

Definition at line 314 of file GEOObjects.h.

315 {};

◆ appendPolylineVecCallback

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

Definition at line 308 of file GEOObjects.h.

309 {};

◆ appendSurfaceVecCallback

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

Definition at line 317 of file GEOObjects.h.

318 {};

◆ removePolylineVecCallback

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

Definition at line 311 of file GEOObjects.h.

312 {};

◆ removeSurfaceVecCallback

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

Definition at line 320 of file GEOObjects.h.

321 {};

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