OGS
|
This class manages pointers to Points in a std::vector along with a name. It also handles the deletion of points. Furthermore, typically, PointVec objects are managed by GEOObjects using the instance name for identification. For this reason PointVec must have a unique name.
Definition at line 35 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 Types inherited from GeoLib::TemplateVec< Point > | |
using | NameIdPair |
using | NameIdMap |
Public Member Functions | |
PointVec (std::string const &name, std::vector< Point * > &&points, NameIdMap &&name_id_map, PointType const type=PointVec::PointType::POINT, double const rel_eps=std::numeric_limits< double >::epsilon()) | |
PointVec (std::string const &name, std::vector< Point * > &&points, PointType const type=PointVec::PointType::POINT, double const 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. | |
void | resetInternalDataStructures () |
Public Member Functions inherited from GeoLib::TemplateVec< Point > | |
TemplateVec (std::string const &name, std::vector< Point * > &&data_vec, NameIdMap &&elem_name_map) | |
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. | |
NameIdMap::const_iterator | getNameIDMapEnd () const |
Returns the end of the name id mapping structure. | |
std::size_t | size () const |
std::vector< Point * > const & | 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. | |
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. | |
bool | getNameOfElement (const Point *data, std::string &name) const |
Private Member Functions | |
void | correctNameIDMapping () |
PointVec (PointVec &&)=delete | |
PointVec (const PointVec &)=delete | |
PointVec ()=delete | |
PointVec & | operator= (const PointVec &rhs)=delete |
PointVec & | operator= (PointVec &&rhs)=delete |
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 Member Functions inherited from GeoLib::TemplateVec< Point > | |
TemplateVec (TemplateVec const &)=delete | |
TemplateVec (TemplateVec &&)=delete | |
TemplateVec & | operator= (TemplateVec const &rhs)=delete |
TemplateVec & | operator= (TemplateVec &&rhs)=delete |
Protected Attributes inherited from GeoLib::TemplateVec< Point > | |
std::string | _name |
std::vector< Point * > | _data_vec |
NameIdMap | _name_id_map |
|
strong |
GeoLib::PointVec::PointVec | ( | std::string const & | name, |
std::vector< Point * > && | points, | ||
NameIdMap && | name_id_map, | ||
PointType const | type = PointVec::PointType::POINT, | ||
double const | rel_eps = std::numeric_limits<double>::epsilon() ) |
Constructor initializes the name of the PointVec object, and moves the points vector into the internal data structure.
name | the name of the point set |
points | R-value reference 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, defaults to PointVec::PointType::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 rel_eps value gives the real tolerance \(\varepsilon\). Two points \(p_0\) and \(p_1\) are considered identical if \(|p_1 - p_0|
\le \varepsilon.\) |
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().
GeoLib::PointVec::PointVec | ( | std::string const & | name, |
std::vector< Point * > && | points, | ||
PointType const | type = PointVec::PointType::POINT, | ||
double const | rel_eps = std::numeric_limits<double>::epsilon() ) |
This constructor is similar to the above constructor with the exception that the NameIdMap must not be passed.
Definition at line 127 of file PointVec.cpp.
|
privatedelete |
|
privatedelete |
|
privatedelete |
|
private |
After the point set is modified (for example by makePntsUnique()) the mapping has to be corrected.
Definition at line 205 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 MeshToolsLib::convertMeshToGeo(), FileIO::SwmmInterface::convertSwmmInputToGeometry(), GeoLib::createPolyline(), GeoLib::IO::BoostXmlGmlInterface::readFile(), GeoLib::IO::XmlGmlInterface::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 248 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(), and writeBCsAndGeometry().
|
inline |
get the type of Point, this can be either POINT or STATION
Definition at line 95 of file PointVec.h.
References _type.
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 133 of file PointVec.cpp.
References _id_to_name_map, _pnt_id_map, push_back(), and uniqueInsert().
Referenced by FileIO::GMSH::GMSHPolygonTree::checkIntersectionsSegmentExistingPolylines(), GeoLib::computeAndInsertAllIntersectionPoints(), FileIO::GMSH::GMSHPolygonTree::insertPolyline(), MeshGeoToolsLib::insertSubSegments(), push_back(), 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 140 of file PointVec.cpp.
References _id_to_name_map, GeoLib::TemplateVec< Point >::_name_id_map, _pnt_id_map, 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 259 of file PointVec.cpp.
References _aabb, GeoLib::TemplateVec< Point >::_data_vec, _oct_tree, _rel_eps, GeoLib::AABB::getMaxPoint(), GeoLib::AABB::getMinMaxPoints(), and GeoLib::AABB::getMinPoint().
Referenced by MeshGeoToolsLib::mapPolylineOnSurfaceMesh().
|
overridevirtual |
Sets the given name for the element of the given ID.
Reimplemented from GeoLib::TemplateVec< Point >.
Definition at line 253 of file PointVec.cpp.
References _id_to_name_map, 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 165 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(), and push_back().
|
private |
Definition at line 151 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 149 of file PointVec.h.
Referenced by PointVec(), getItemNameByID(), push_back(), push_back(), and setNameForElement().
|
private |
Definition at line 153 of file PointVec.h.
Referenced by PointVec(), resetInternalDataStructures(), and uniqueInsert().
|
private |
permutation of the geometric elements according to their lexicographical order
Definition at line 145 of file PointVec.h.
Referenced by PointVec(), correctNameIDMapping(), getIDMap(), push_back(), and push_back().
|
private |
Definition at line 152 of file PointVec.h.
Referenced by resetInternalDataStructures(), and uniqueInsert().
|
private |
the type of the point (
Definition at line 139 of file PointVec.h.
Referenced by getType().