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
60 PointVec(std::string const& name, std::vector<Point*>&& points,
61 NameIdMap&& name_id_map,
63 double const rel_eps = std::numeric_limits<double>::epsilon());
68 PointVec(std::string const& name, std::vector<Point*>&& points,
70 double const rel_eps = std::numeric_limits<double>::epsilon());
71
80 std::size_t push_back(Point* pnt);
81
87 void push_back(Point* pnt, std::string const* const name) override;
88
92 PointType getType() const { return _type; }
93
94 const std::vector<std::size_t>& getIDMap() const { return _pnt_id_map; }
95
96 const GeoLib::AABB& getAABB() const;
97
98 std::string const& getItemNameByID(std::size_t id) const;
99
100 void setNameForElement(std::size_t id, std::string const& name) override;
101
108
109private:
115
116 PointVec(PointVec&&) = delete;
117 PointVec(const PointVec&) = delete;
118 PointVec() = delete;
119 PointVec& operator=(const PointVec& rhs) = delete;
120 PointVec& operator=(PointVec&& rhs) = delete;
121
133 std::size_t uniqueInsert(Point* pnt);
134
137
142 std::vector<std::size_t> _pnt_id_map;
143
146 std::vector<std::string> _id_to_name_map;
147
149 double _rel_eps;
150 std::unique_ptr<GeoLib::OctTree<GeoLib::Point, 16>> _oct_tree;
151};
152} // 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:146
PointType getType() const
Definition PointVec.h:92
PointType _type
Definition PointVec.h:136
std::unique_ptr< GeoLib::OctTree< GeoLib::Point, 16 > > _oct_tree
Definition PointVec.h:150
std::vector< std::size_t > _pnt_id_map
Definition PointVec.h:142
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:94
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...
Definition TemplateVec.h:38
std::map< std::string, std::size_t > NameIdMap
Definition TemplateVec.h:41