OGS
PointVec.h
Go to the documentation of this file.
1
15#pragma once
16
17#include <map>
18#include <memory>
19#include <string>
20#include <vector>
21
22#include "AABB.h"
23#include "OctTree.h"
24#include "Point.h"
25#include "TemplateVec.h"
26
27namespace GeoLib
28{
35class PointVec final : public TemplateVec<Point>
36{
37public:
39 enum class PointType
40 {
41 POINT = 0,
42 STATION = 1
43 };
44
63 PointVec(std::string const& name, std::vector<Point*>&& points,
64 NameIdMap&& name_id_map,
66 double const rel_eps = std::numeric_limits<double>::epsilon());
71 PointVec(std::string const& name, std::vector<Point*>&& points,
73 double const rel_eps = std::numeric_limits<double>::epsilon());
74
83 std::size_t push_back(Point* pnt);
84
90 void push_back(Point* pnt, std::string const* const name) override;
91
95 PointType getType() const { return _type; }
96
97 const std::vector<std::size_t>& getIDMap() const { return _pnt_id_map; }
98
99 const GeoLib::AABB& getAABB() const;
100
101 std::string const& getItemNameByID(std::size_t id) const;
102
103 void setNameForElement(std::size_t id, std::string const& name) override;
104
111
112private:
118
119 PointVec(PointVec&&) = delete;
120 PointVec(const PointVec&) = delete;
121 PointVec() = delete;
122 PointVec& operator=(const PointVec& rhs) = delete;
123 PointVec& operator=(PointVec&& rhs) = delete;
124
136 std::size_t uniqueInsert(Point* pnt);
137
140
145 std::vector<std::size_t> _pnt_id_map;
146
149 std::vector<std::string> _id_to_name_map;
150
152 double _rel_eps;
153 std::unique_ptr<GeoLib::OctTree<GeoLib::Point, 16>> _oct_tree;
154};
155} // namespace GeoLib
Definition of the AABB class.
Definition of the Point class.
Implementation of the OctTree class.
Definition of the GeoLib::TemplateVec class.
Class AABB is an axis aligned bounding box around a given set of geometric points of (template) type ...
Definition AABB.h:56
This class manages pointers to Points in a std::vector along with a name. It also handles the deletio...
Definition PointVec.h:36
std::vector< std::string > _id_to_name_map
Definition PointVec.h:149
PointType getType() const
Definition PointVec.h:95
PointType _type
Definition PointVec.h:139
std::unique_ptr< GeoLib::OctTree< GeoLib::Point, 16 > > _oct_tree
Definition PointVec.h:153
std::vector< std::size_t > _pnt_id_map
Definition PointVec.h:145
const GeoLib::AABB & getAABB() const
std::size_t uniqueInsert(Point *pnt)
Definition PointVec.cpp:165
const std::vector< std::size_t > & getIDMap() const
Definition PointVec.h:97
void setNameForElement(std::size_t id, std::string const &name) override
Sets the given name for the element of the given ID.
Definition PointVec.cpp:253
std::size_t push_back(Point *pnt)
Definition PointVec.cpp:133
PointVec & operator=(PointVec &&rhs)=delete
std::string const & getItemNameByID(std::size_t id) const
Definition PointVec.cpp:248
PointVec(const PointVec &)=delete
PointType
Signals if the vector contains object of type Point or Station.
Definition PointVec.h:40
PointVec & operator=(const PointVec &rhs)=delete
void correctNameIDMapping()
Definition PointVec.cpp:205
PointVec(PointVec &&)=delete
void resetInternalDataStructures()
Definition PointVec.cpp:259
The class TemplateVec takes a unique name and manages a std::vector of pointers to data elements of t...
std::map< std::string, std::size_t > NameIdMap
Definition TemplateVec.h:41