OGS
PointVec.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
6#include <map>
7#include <memory>
8#include <string>
9#include <vector>
10
11#include "AABB.h"
12#include "OctTree.h"
13#include "Point.h"
14#include "TemplateVec.h"
15
16namespace GeoLib
17{
24class PointVec final : public TemplateVec<Point>
25{
26public:
28 enum class PointType
29 {
30 POINT = 0,
32 };
33
52 PointVec(std::string const& name, std::vector<Point*>&& points,
53 NameIdMap&& name_id_map,
55 double const rel_eps = std::numeric_limits<double>::epsilon());
60 PointVec(std::string const& name, std::vector<Point*>&& points,
62 double const rel_eps = std::numeric_limits<double>::epsilon());
63
72 std::size_t push_back(Point* pnt);
73
79 void push_back(Point* pnt, std::string const* const name) override;
80
84 PointType getType() const { return _type; }
85
86 const std::vector<std::size_t>& getIDMap() const { return _pnt_id_map; }
87
88 const GeoLib::AABB& getAABB() const;
89
90 std::string const& getItemNameByID(std::size_t id) const;
91
92 void setNameForElement(std::size_t id, std::string const& name) override;
93
100
101private:
107
108 PointVec(PointVec&&) = delete;
109 PointVec(const PointVec&) = delete;
110 PointVec() = delete;
111 PointVec& operator=(const PointVec& rhs) = delete;
112 PointVec& operator=(PointVec&& rhs) = delete;
113
125 std::size_t uniqueInsert(Point* pnt);
126
129
134 std::vector<std::size_t> _pnt_id_map;
135
138 std::vector<std::string> _id_to_name_map;
139
141 double _rel_eps;
142 std::unique_ptr<GeoLib::OctTree<GeoLib::Point, 16>> _oct_tree;
143};
144} // namespace GeoLib
Class AABB is an axis aligned bounding box around a given set of geometric points of (template) type ...
Definition AABB.h:45
std::vector< std::string > _id_to_name_map
Definition PointVec.h:138
PointType getType() const
Definition PointVec.h:84
PointType _type
Definition PointVec.h:128
std::unique_ptr< GeoLib::OctTree< GeoLib::Point, 16 > > _oct_tree
Definition PointVec.h:142
std::vector< std::size_t > _pnt_id_map
Definition PointVec.h:134
const GeoLib::AABB & getAABB() const
std::size_t uniqueInsert(Point *pnt)
Definition PointVec.cpp:156
const std::vector< std::size_t > & getIDMap() const
Definition PointVec.h:86
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:244
std::size_t push_back(Point *pnt)
Definition PointVec.cpp:124
PointVec & operator=(PointVec &&rhs)=delete
std::string const & getItemNameByID(std::size_t id) const
Definition PointVec.cpp:239
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())
Definition PointVec.cpp:13
PointVec(const PointVec &)=delete
PointType
Signals if the vector contains object of type Point or Station.
Definition PointVec.h:29
PointVec & operator=(const PointVec &rhs)=delete
void correctNameIDMapping()
Definition PointVec.cpp:196
PointVec(PointVec &&)=delete
void resetInternalDataStructures()
Definition PointVec.cpp:250
std::map< std::string, std::size_t > NameIdMap
Definition TemplateVec.h:30
TemplateVec(std::string const &name, std::vector< Point * > &&data_vec, NameIdMap &&elem_name_map)
Definition TemplateVec.h:44