OGS
|
This class manages pointers to Points in a std::vector along with a name. It also handles the deleting of points. Additionally, each vector of points is identified by a unique name from class GEOObject. For this reason PointVec should have a name.
Definition at line 38 of file PointVec.h.
#include <PointVec.h>
Public Types | |
enum class | PointType { POINT = 0 , STATION = 1 } |
Signals if the vector contains object of type Point or Station. More... | |
Public Member Functions | |
PointVec (const std::string &name, std::unique_ptr< std::vector< Point * >> points, std::unique_ptr< std::map< std::string, std::size_t >> name_id_map=nullptr, PointType type=PointVec::PointType::POINT, double rel_eps=std::numeric_limits< double >::epsilon()) | |
std::size_t | push_back (Point *pnt) |
void | push_back (Point *pnt, std::string const *const name) override |
PointType | getType () const |
const std::vector< std::size_t > & | getIDMap () const |
const GeoLib::AABB & | getAABB () const |
std::string const & | getItemNameByID (std::size_t id) const |
void | setNameForElement (std::size_t id, std::string const &name) override |
Sets the given name for the element of the given ID. More... | |
void | resetInternalDataStructures () |
Public Member Functions inherited from GeoLib::TemplateVec< Point > | |
TemplateVec (std::string name, std::unique_ptr< std::vector< Point * >> data_vec, std::unique_ptr< NameIdMap > elem_name_map=nullptr) | |
virtual | ~TemplateVec () |
void | setName (const std::string &n) |
std::string | getName () const |
NameIdMap::const_iterator | getNameIDMapBegin () const |
Returns the begin of the name id mapping structure. More... | |
NameIdMap::const_iterator | getNameIDMapEnd () const |
Returns the end of the name id mapping structure. More... | |
std::size_t | size () const |
const std::vector< Point * > * | getVector () const |
bool | getElementIDByName (const std::string &name, std::size_t &id) const |
const Point * | getElementByName (const std::string &name) const |
Returns an element with the given name. More... | |
bool | getNameOfElementByID (std::size_t id, std::string &element_name) const |
void | setNameOfElementByID (std::size_t id, std::string const &element_name) |
Return the name of an element based on its ID. More... | |
bool | getNameOfElement (const Point *data, std::string &name) const |
Private Member Functions | |
void | correctNameIDMapping () |
PointVec (const PointVec &) | |
PointVec () | |
PointVec & | operator= (const PointVec &rhs) |
std::size_t | uniqueInsert (Point *pnt) |
Private Attributes | |
PointType | _type |
std::vector< std::size_t > | _pnt_id_map |
std::vector< std::string > | _id_to_name_map |
AABB | _aabb |
double | _rel_eps |
std::unique_ptr< GeoLib::OctTree< GeoLib::Point, 16 > > | _oct_tree |
Additional Inherited Members | |
Protected Types inherited from GeoLib::TemplateVec< Point > | |
using | NameIdPair = std::pair< std::string, std::size_t > |
using | NameIdMap = std::map< std::string, std::size_t > |
Protected Member Functions inherited from GeoLib::TemplateVec< Point > | |
TemplateVec (const TemplateVec &) | |
TemplateVec & | operator= (const TemplateVec &rhs) |
Protected Attributes inherited from GeoLib::TemplateVec< Point > | |
std::string | _name |
std::unique_ptr< std::vector< Point * > > | _data_vec |
std::unique_ptr< NameIdMap > | _name_id_map |
|
strong |
Signals if the vector contains object of type Point or Station.
Enumerator | |
---|---|
POINT | |
STATION |
Definition at line 42 of file PointVec.h.
GeoLib::PointVec::PointVec | ( | const std::string & | name, |
std::unique_ptr< std::vector< Point * >> | points, | ||
std::unique_ptr< std::map< std::string, std::size_t >> | name_id_map = nullptr , |
||
PointType | type = PointVec::PointType::POINT , |
||
double | rel_eps = std::numeric_limits<double>::epsilon() |
||
) |
Constructor initializes the name of the PointVec object, the internal pointer _pnt_vec to the raw points and the internal pointer the vector of names of the points and sets the type of PointVec.
name | the name of the point group |
points | Pointer to a vector of pointers to GeoLib::Points. |
name_id_map | A std::map that stores the relation name to point. |
type | the type of the point, |
rel_eps | This is a relative error tolerance value for the test of identical points. The size of the axis aligned bounding box multiplied with the value of rel_eps gives the real tolerance \(tol\). Two points \(p_0, p_1 \) are identical iff \(|p_1 - p_0| \le tol.\) |
Definition at line 22 of file PointVec.cpp.
References GeoLib::TemplateVec< Point >::_data_vec, _id_to_name_map, GeoLib::TemplateVec< Point >::_name_id_map, _oct_tree, _pnt_id_map, correctNameIDMapping(), MathLib::Point3dWithID::getID(), and WARN().
|
private |
copy constructor doesn't have an implementation
|
private |
standard constructor doesn't have an implementation
|
private |
After the point set is modified (for example by makePntsUnique()) the mapping has to be corrected.
Definition at line 201 of file PointVec.cpp.
References GeoLib::TemplateVec< Point >::_name_id_map, and _pnt_id_map.
Referenced by PointVec().
const GeoLib::AABB& GeoLib::PointVec::getAABB | ( | ) | const |
|
inline |
Definition at line 97 of file PointVec.h.
References _pnt_id_map.
Referenced by MeshLib::convertMeshToGeo(), FileIO::SwmmInterface::convertSwmmInputToGeometry(), GeoLib::IO::XmlGmlInterface::readFile(), GeoLib::IO::BoostXmlGmlInterface::readFile(), FileIO::Legacy::readGLIFileV4(), FileIO::SHPInterface::readPolylines(), and FileIO::TetGenInterface::readTetGenGeometry().
std::string const & GeoLib::PointVec::getItemNameByID | ( | std::size_t | id | ) | const |
Definition at line 244 of file PointVec.cpp.
References _id_to_name_map.
Referenced by GeoLib::geoPointsToStations(), GeoLib::GEOObjects::mergePoints(), GeoLib::IO::BoostXmlGmlInterface::write(), GeoLib::IO::XmlGmlInterface::write(), FileIO::Legacy::writeAllDataToGLIFileV4(), writeBCsAndGeometry(), and FileIO::Legacy::writeGLIFileV4().
|
inline |
get the type of Point, this can be either POINT or STATION
Definition at line 95 of file PointVec.h.
References _type.
assignment operator doesn't have an implementation
std::size_t GeoLib::PointVec::push_back | ( | Point * | pnt | ) |
Method adds a Point to the (internal) standard vector and takes the ownership. If the given point is already included in the vector, the point will be destroyed and the id of the existing point will be returned.
pnt | the pointer to the Point |
Definition at line 129 of file PointVec.cpp.
References _id_to_name_map, _pnt_id_map, and uniqueInsert().
Referenced by FileIO::GMSH::GMSHPolygonTree::checkIntersectionsSegmentExistingPolylines(), GeoLib::computeAndInsertAllIntersectionPoints(), FileIO::GMSH::GMSHPolygonTree::insertPolyline(), MeshGeoToolsLib::insertSubSegments(), and GeoLib::IO::TINInterface::readTIN().
|
overridevirtual |
push_back adds new elements at the end of the vector _data_vec.
pnt | a pointer to the point, PointVec takes ownership of the point |
name | the name of the point |
Reimplemented from GeoLib::TemplateVec< Point >.
Definition at line 136 of file PointVec.cpp.
References _id_to_name_map, GeoLib::TemplateVec< Point >::_name_id_map, _pnt_id_map, MaterialPropertyLib::name, uniqueInsert(), and WARN().
void GeoLib::PointVec::resetInternalDataStructures | ( | ) |
Resets the internal data structures, i.e., the axis aligned bounding box, the relative epsilon for the equality tests and the oct tree data structure.
Definition at line 255 of file PointVec.cpp.
References _aabb, GeoLib::TemplateVec< Point >::_data_vec, _oct_tree, _rel_eps, GeoLib::AABB::getMaxPoint(), GeoLib::AABB::getMinPoint(), and MathLib::LinAlg::norm().
Referenced by MeshGeoToolsLib::mapPolylineOnSurfaceMesh().
|
overridevirtual |
Sets the given name for the element of the given ID.
Reimplemented from GeoLib::TemplateVec< Point >.
Definition at line 249 of file PointVec.cpp.
References _id_to_name_map, MaterialPropertyLib::name, and GeoLib::TemplateVec< T >::setNameForElement().
Referenced by GEOModels::addNameForElement(), and GEOModels::addNameForObjectPoints().
|
private |
Inserts the instance of the Point into internal data structures (
pnt | Pointer to GeooLib::Point instance |
Definition at line 161 of file PointVec.cpp.
References _aabb, GeoLib::TemplateVec< Point >::_data_vec, _oct_tree, _rel_eps, MathLib::Point3dWithID::getID(), GeoLib::AABB::getMaxPoint(), GeoLib::AABB::getMinPoint(), MathLib::Point3dWithID::setID(), and GeoLib::AABB::update().
Referenced by push_back().
|
private |
Definition at line 154 of file PointVec.h.
Referenced by resetInternalDataStructures(), and uniqueInsert().
|
private |
The reverse map to the name to id map, for fast lookup of the name to a given point id.
Definition at line 152 of file PointVec.h.
Referenced by PointVec(), getItemNameByID(), push_back(), and setNameForElement().
|
private |
Definition at line 156 of file PointVec.h.
Referenced by PointVec(), resetInternalDataStructures(), and uniqueInsert().
|
private |
permutation of the geometric elements according to their lexicographical order
Definition at line 148 of file PointVec.h.
Referenced by PointVec(), correctNameIDMapping(), getIDMap(), and push_back().
|
private |
Definition at line 155 of file PointVec.h.
Referenced by resetInternalDataStructures(), and uniqueInsert().
|
private |
the type of the point (
Definition at line 142 of file PointVec.h.
Referenced by getType().