23 NameIdMap&& name_id_map,
PointType const type,
27 _aabb(_data_vec.begin(), _data_vec.end()),
28 _rel_eps(rel_eps * (_aabb.getMaxPoint() - _aabb.getMinPoint()).norm()),
30 _aabb.getMinPoint(), _aabb.getMaxPoint(), _rel_eps))
32 std::size_t
const number_of_all_input_pnts(
_data_vec.size());
35 for (std::size_t k(0); k <
_data_vec.size(); ++k)
37 if (
_data_vec[k]->getID() == std::numeric_limits<std::size_t>::max())
43 std::vector<std::size_t> rm_pos;
48 for (std::size_t k(0); k <
_data_vec.size(); ++k)
53 assert(ret_pnt !=
nullptr);
65 auto const data_vec_end =
72 for (std::size_t k(1); k < rm_pos.size(); ++k)
75 for (std::size_t j(rm_pos[k - 1] + 1); j < rm_pos[k]; ++j)
83 for (std::size_t j(rm_pos.back() + 1); j <
_pnt_id_map.size(); ++j)
90 for (std::size_t k(1); k < rm_pos.size(); ++k)
94 cnt < rm_pos.size() &&
_pnt_id_map[rm_pos[k]] > rm_pos[cnt];)
102 for (std::size_t k(0); k <
_data_vec.size(); ++k)
107 if (number_of_all_input_pnts >
_data_vec.size())
109 WARN(
"PointVec::PointVec(): there are {:d} double points.",
110 number_of_all_input_pnts -
_data_vec.size());
128 PointType const type,
double const rel_eps)
129 :
PointVec(name, std::move(points), NameIdMap{}, type, rel_eps)
149 std::map<std::string, std::size_t>::const_iterator it(
154 WARN(
"PointVec::push_back(): two points share the name {:s}.",
178 if (ret_pnt ==
nullptr)
186 for (std::size_t k(0); k <
_data_vec.size(); ++k)
202 return ret_pnt->
getID();
208 std::vector<std::string> id_names(
_pnt_id_map.size(), std::string(
""));
211 id_names[id_name_pair.second] = id_name_pair.first;
217 const std::size_t id(it->second);
262 double const rel_eps(
_rel_eps / (max - min).norm());
void WARN(fmt::format_string< Args... > fmt, Args &&... args)
Definition of the PointVec class.
Class AABB is an axis aligned bounding box around a given set of geometric points of (template) type ...
Eigen::Vector3d const & getMaxPoint() const
Eigen::Vector3d const & getMinPoint() const
MinMaxPoints getMinMaxPoints() const
bool update(PNT_TYPE const &p)
This class manages pointers to Points in a std::vector along with a name. It also handles the deletio...
std::vector< std::string > _id_to_name_map
std::unique_ptr< GeoLib::OctTree< GeoLib::Point, 16 > > _oct_tree
std::vector< std::size_t > _pnt_id_map
std::size_t uniqueInsert(Point *pnt)
void setNameForElement(std::size_t id, std::string const &name) override
Sets the given name for the element of the given ID.
std::size_t push_back(Point *pnt)
std::string const & getItemNameByID(std::size_t id) const
PointType
Signals if the vector contains object of type Point or Station.
void correctNameIDMapping()
void resetInternalDataStructures()
The class TemplateVec takes a unique name and manages a std::vector of pointers to data elements of t...
std::vector< Point * > _data_vec
virtual void setNameForElement(std::size_t id, std::string const &name)
Sets the given name for the element of the given ID.
std::size_t getID() const
void setID(std::size_t id)
Sets the ID of a node to the given value.