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{
37class PointVec final : public TemplateVec<Point>
38{
39public:
41 enum class PointType
42 {
43 POINT = 0,
44 STATION = 1
45 };
46
62 PointVec(std::string const& name, std::vector<Point*>&& points,
63 NameIdMap&& name_id_map,
65 double const rel_eps = std::numeric_limits<double>::epsilon());
70 PointVec(std::string const& name, std::vector<Point*>&& points,
72 double const rel_eps = std::numeric_limits<double>::epsilon());
73
82 std::size_t push_back(Point* pnt);
83
89 void push_back(Point* pnt, std::string const* const name) override;
90
94 PointType getType() const { return _type; }
95
96 const std::vector<std::size_t>& getIDMap() const { return _pnt_id_map; }
97
98 const GeoLib::AABB& getAABB() const;
99
100 std::string const& getItemNameByID(std::size_t id) const;
101
102 void setNameForElement(std::size_t id, std::string const& name) override;
103
110
111private:
117
118 PointVec(PointVec&&) = delete;
119 PointVec(const PointVec&) = delete;
120 PointVec() = delete;
121 PointVec& operator=(const PointVec& rhs) = delete;
122 PointVec& operator=(PointVec&& rhs) = delete;
123
135 std::size_t uniqueInsert(Point* pnt);
136
139
144 std::vector<std::size_t> _pnt_id_map;
145
148 std::vector<std::string> _id_to_name_map;
149
151 double _rel_eps;
152 std::unique_ptr<GeoLib::OctTree<GeoLib::Point, 16>> _oct_tree;
153};
154} // namespace GeoLib
Definition of the AABB 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:38
std::vector< std::string > _id_to_name_map
Definition: PointVec.h:148
double _rel_eps
Definition: PointVec.h:151
PointType getType() const
Definition: PointVec.h:94
PointType _type
Definition: PointVec.h:138
std::unique_ptr< GeoLib::OctTree< GeoLib::Point, 16 > > _oct_tree
Definition: PointVec.h:152
std::vector< std::size_t > _pnt_id_map
Definition: PointVec.h:144
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:96
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:42
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:40
std::map< std::string, std::size_t > NameIdMap
Definition: TemplateVec.h:43